GLBasic forum

Main forum => Bug Reports => Topic started by: Ian Price on 2011-Aug-16

Title: Bug with data statements
Post by: Ian Price on 2011-Aug-16
I've just received an unexpected error message when using data

QuoteC:\Users\Ian\AppData\Local\Temp\glbasic\gpc_tempg.cpp:99:9: invalid digit "9" in octal constant
C:\Users\Ian\AppData\Local\Temp\glbasic\gpc_tempg.cpp:109:9: invalid digit "8" in octal constant

This occurred because I used the value "08" and "09" (without quotes) in my data - this was to ensure that each line of data included the same number of datum.

Quote
// Level 1 data
STARTDATA level1:

DATA 00,00,01,02,02,02,02,03,00,00
DATA 00,01,06,99,99,99,99,07,03,00
DATA 01,06,99,99,99,99,99,99,07,03
DATA 06,99,99,99,99,99,99,99,99,07
DATA 99,99,99,99,99,99,99,99,99,99
DATA 99,99,99,99,99,99,99,99,99,99
DATA 99,99,99,99,99,99,99,99,99,99
DATA 99,99,99,99,99,99,99,99,99,99
DATA 14,99,99,99,99,99,99,99,99,15
DATA 09,14,99,99,99,99,99,99,15,11
DATA 08,09,14,99,99,99,99,15,11,00
DATA 08,08,09,10,10,10,10,11,00,00

ENDDATA

Interestingly enough the numbers "00" - "07" are all fine. Replacing "08" and "09" with just plain "8" and  "9" didn't bring up the error at all.

Real two digit numbers "10" - "99" are not affected.

Title: Re: Bug with data statements
Post by: Ian Price on 2011-Aug-16
I guessed it might be something like that (octal being 8 and all (0-7)).
Title: Re: Bug with data statements
Post by: Slydog on 2011-Aug-16
Somebody had a VERY similar problem recently.

The problem is that OCTAL can only use the digits 0 thru 7, and GLBs way of letting you input OCTAL numbers is by prefixing them with a '0'.  So 00 to 07 are fine, but 08 and 09 are invalid because GLB thinks you are defining an OCTAL, but 8 and 9 and invalid. 

Instead of prefixing with a zero, '08', use a space, like ' 8' to keep your formatting tidy.

[Edit]  Oops I was too late in responding!
Title: Re: Bug with data statements
Post by: Ian Price on 2011-Aug-16
Yeah, I'll do that (use space). I haven't got much data to enter - it's just not something I've seen in GLB before.
Title: Re: Bug with data statements
Post by: Slydog on 2011-Aug-16
Does ANYBODY use octal numbers these days?  (ha, I don't even know WHEN I'd use them, unlike hex)
It may clean things up to just remove them from GLB entirely.