Qbasicnews.com
July 04, 2020, 09:04:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Did I miss comething with variables?  (Read 4113 times)
fsw
Guru
**
Posts: 251


« on: February 08, 2005, 06:02:50 PM »

While playing around with old code I commented out some variable declarations and fbc compiled without errors.

Is this intentional?

If so  Cool

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

BTW it's the cvs fbc dated Feb07.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #1 on: February 08, 2005, 06:18:13 PM »

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.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
fsw
Guru
**
Posts: 251


« Reply #2 on: February 08, 2005, 06:45:28 PM »

Quote from: "na_th_an"
... "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.... Shocked
 :bounce:
Logged
BastetFurry
Forum Regular
**
Posts: 136



WWW
« Reply #3 on: February 08, 2005, 07:14:44 PM »

Quote from: "na_th_an"
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
Logged

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]
v3cz0r
I hold this place together
*****
Posts: 924



WWW
« Reply #4 on: February 10, 2005, 01:49:10 AM »

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.
Logged

na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #5 on: February 10, 2005, 04:58:40 AM »

Quote from: "BastetFurry"
Quote from: "na_th_an"
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.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
BastetFurry
Forum Regular
**
Posts: 136



WWW
« Reply #6 on: February 10, 2005, 05:08:56 AM »

Quote from: "na_th_an"
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 from: "na_th_an"

1.- Simple procedural language for beginners


Ok

Quote from: "na_th_an"

2.- Non case sensitive


No problem with that either

Quote from: "na_th_an"

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.
Logged

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]
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #7 on: February 10, 2005, 05:39:37 AM »

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.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
MystikShadows
Ancient Guru
****
Posts: 542



WWW
« Reply #8 on: February 12, 2005, 01:37:07 PM »

Quote from: "na_th_an"
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.
Logged

hen they say it can't be done, THAT's when they call me ;-).




need hosting:  http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #9 on: February 13, 2005, 12:31:19 AM »

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.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!