Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Did I miss comething with variables?
#1
While playing around with old code I commented out some variable declarations and fbc compiled without errors.

Is this intentional?

If so 8)

Looked again at the changelog and found nothing about that...

BTW it's the cvs fbc dated Feb07.
Reply
#2
You don't have to declare variables in BASIC.

Modern BASIC compilers (such as Visual Basic) added the directive "Option Explicit" to force the coder to declare variables.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
Quote:... "Option Explicit" to force the coder to declare variables.
Yeah that's the one.
Finally I know what that does :oops:
Never worked with basic's that had "Option Explicit" :wink:
Actually this was the first example code I had without it :lol:
Thanks

Have to take a look into my fb-manual.
Manual, where is my manual.... :o
:bounce:
Reply
#4
Quote:You don't have to declare variables in BASIC.

Modern BASIC compilers (such as Visual Basic) added the directive "Option Explicit" to force the coder to declare variables.

Some are forced in that, look at BCX
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Reply
#5
When using some lib is always safer to use option explicit, otherwise one misspelled constant/define used and nothing seems to work.. Explicit is not enabled by default to be backward compatible with QB/VB.
Reply
#6
Quote:
na_th_an Wrote:You don't have to declare variables in BASIC.

Modern BASIC compilers (such as Visual Basic) added the directive "Option Explicit" to force the coder to declare variables.

Some are forced in that, look at BCX
And I bet that you can find a BASIC that fries eggs Tongue

That's not the standard, obviously. The Standard about basic says, basicly, three things:

1.- Simple procedural language for beginners
2.- Non case sensitive
3.- Variables don't need to be declared.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#7
Quote:And I bet that you can find a BASIC that fries eggs Tongue

Cool! I want that one! No wait, better a basic that can make some "coffe con leche"... hmm... i have the urge to pack the camper and have a drive to (Playa de) Oliva in Valencia, but on the other hand, dont like to drive ~1800 km just for a coffe.

Quote:1.- Simple procedural language for beginners

Ok

Quote:2.- Non case sensitive

No problem with that either

Quote:3.- Variables don't need to be declared.

Might be a problem.
At the beginning you give an integer called zyzig some value.
Some way down you call it zyzyg and some way down again you call it zizyg. Pool Of Errors i would say.
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Reply
#8
I'm not saying it's good, I'm saying "that's the way it is".

I know, that sucks, variables should be declared, but that's a new feature that was not in the specs of BASIC. Read the ISO Standard for Minimal BASIC to check it out.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#9
Quote:I'm not saying it's good, I'm saying "that's the way it is".

I know, that sucks, variables should be declared, but that's a new feature that was not in the specs of BASIC. Read the ISO Standard for Minimal BASIC to check it out.

Minimal BASIC is the keyword here.

ENUMS don't have to be there either but I pitty the fool that ever decides to take em off. LOL...

I would advice using Option Explicit (or at least declaring your variables) for any lib/binding that has been written by another language. For example, SDL, OpenGL, Allegro. Just to be on the safe side of things.
hen they say it can't be done, THAT's when they call me ;-).

[Image: kaffee.gif]
[Image: mystikshadows.png]

need hosting: http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Reply
#10
Again, that's the way to go. I was just pointing out that BASIC doesn't need you to declare variables. It's a language feature, it doesn't mean it is good practice nor that I encourage it. GOSUB is there, and it is not good practice either. LET or CALL are there, but you don't need to write those keywords.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)