GLBasic forum

Main forum => Bug Reports => Topic started by: Uncle on 2009-Aug-23

Title: Problems compiling with 7.089 - CONST throws a syntax error
Post by: Uncle on 2009-Aug-23
Just updated to 7.089 and now my code which ran well under 7.087 fails with syntax errors.  if fails to compile CONST declarations.  Did something change?

[EDIT] whats strange is that const is still highlighted as a reserved word in the IDE, but instead of being in capitals it always reverts to lowercase. 

Cheers,

Unc
Title: Re: Problems compiling with 7.089 - CONST throws a syntax error
Post by: MikeHart on 2009-Aug-23
Change it to CONSTANT. It's still a command in progress.
Title: Re: Problems compiling with 7.089 - CONST throws a syntax error
Post by: MrTAToad on 2009-Aug-23
The CONST command is reserved for future expansion and currently wont work.
Title: Re: Problems compiling with 7.089 - CONST throws a syntax error
Post by: Uncle on 2009-Aug-23
Yep that fixed it.  Thanks guys.  Shame I used const throughout most of the programs I have written so far  :S  Find and replace here I come :)
Title: Re: Problems compiling with 7.089 - CONST throws a syntax error
Post by: Kitty Hello on 2009-Aug-25
No, if you use CONSTANT, and it compiles, you can be happy.
But there are occasions where it won't compile!
Title: Re: Problems compiling with 7.089 - CONST throws a syntax error
Post by: BdR on 2009-Nov-01
Aha, CONSTANT instead of CONST.. I was wondering why that didn't work :) I had the same problem, I had already created a program with the demo version but in a newer version it didn't compile because of the CONST' s. I use it a lot for defining things like "direction-enumeration" and gameobjects, for example.
Code (glbasic) Select
CONSTANT DIR_UP    = 1
CONSTANT DIR_DOWN  = 2
// etc.

CONSTANT GAMEOBJ_NONE   = 0
CONSTANT GAMEOBJ_WALL   = 1
CONSTANT GAMEOBJ_LADDER = 2
// etc.


I assume GLBasic translates that to #defines in the C++ files, right?
Code (glbasic) Select
#DEFINE GAMEOBJ_NONE   = 0
#DEFINE GAMEOBJ_WALL   = 1
#DEFINE GAMEOBJ_LADDER = 2
// etc.


Occasionally it won't compile? Do you mean when there is a naming conflict or something? For example, when you use a CONSTANT with the same name as a global/local variable or as a function name?
Title: Re: Problems compiling with 7.089 - CONST throws a syntax error
Post by: Kitty Hello on 2009-Nov-02
CONSTANT will b converted to "const DGNat xy = 1;"