Author Topic: Problems compiling with 7.089 - CONST throws a syntax error  (Read 2701 times)

Offline Uncle

  • Mr. Drawsprite
  • **
  • Posts: 75
    • View Profile
    • www.urbaninteractive.net
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
« Last Edit: 2009-Aug-23 by Uncle »

MikeHart

  • Guest
Change it to CONSTANT. It's still a command in progress.

MrTAToad

  • Guest
The CONST command is reserved for future expansion and currently wont work.

Offline Uncle

  • Mr. Drawsprite
  • **
  • Posts: 75
    • View Profile
    • www.urbaninteractive.net
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 :)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
No, if you use CONSTANT, and it compiles, you can be happy.
But there are occasions where it won't compile!

Offline BdR

  • Dr. Type
  • ****
  • Posts: 303
    • View Profile
    • BdR Games
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?

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
CONSTANT will b converted to "const DGNat xy = 1;"