Posts: 251
Threads: 22
Joined: Dec 2004
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.
Posts: 6,419
Threads: 74
Joined: Mar 2002
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.
Posts: 251
Threads: 22
Joined: Dec 2004
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:
Posts: 133
Threads: 19
Joined: Jan 2005
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]
Posts: 922
Threads: 15
Joined: Jun 2003
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.
Posts: 6,419
Threads: 74
Joined: Mar 2002
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
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.
Posts: 133
Threads: 19
Joined: Jan 2005
Quote:And I bet that you can find a BASIC that fries eggs
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]
Posts: 6,419
Threads: 74
Joined: Mar 2002
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.
Posts: 525
Threads: 23
Joined: Oct 2004
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.
Posts: 6,419
Threads: 74
Joined: Mar 2002
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.