Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Weird compiler bug with constants

Author
Message
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 13th Dec 2002 18:36
Try this :-

#CONSTANT maxlaser 3
TEXT 10, 10, "max " + STR$(maxlaser)
wait key

Then try this :-

#CONSTANT maxlaser 3 : rem jjjj
TEXT 10, 70, "max " + STR$(maxlaser)
wait key

On my system the addition of the comment after the constant definition causes an irregular brackets error on the text line, pretty odd little bug!
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 13th Dec 2002 18:42
Very odd - obviously the parser hasn't been set up to check comments on #constant lines...

Good news everybody! I really am THAT good...
Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 13th Dec 2002 19:27
mail lee this one!

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 16th Dec 2002 16:29
Actually I`ve discovered its quite simple, anything after the '#constant whatever ' part gets replaced in the rest of the code, for instance you could use it to make abbreviations for commonly used commands IE '#constant po position object' will replace 'po' with 'position object' anywhere in your code!

in the above bit of code the bit -'STR$(maxlaser)' was getting replaced by 'STR$(3 : rem jjjj)' so its not likely to work!

Also as #constant has not yet made it into the instructions I`m not sure we can complain about it not working properly as its probably not supported yet.

Login to post a reply

Server time is: 2024-05-02 02:23:59
Your offset time is: 2024-05-02 02:23:59