Code Folding Error

Previous topic - Next topic

bigsofty

When I fold certain functions I get the following error when I compile....

C:\DOCUME~1\Dad\LOCALS~1\Temp\glbasic\gpc_temp1.cpp:212: error: stray '\8' in program

Unfolding, then compiling, removes the error?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

Yes, you need to unfold all functions before compiling...

Kitty Hello

paste the function. Works for me when quickly testing.

bigsofty

#3
I would have to post the whole program Gernot as the function uses custom types extensively.

There are no erroneous control characters etc, I checked the file with a hex editor.

This code...

Code (glbasic) Select
tot% = tot% + rand% in GLBasic

...creates this code in "gpc_temp1.cpp"...

         tot = tot + rand;

EDIT: (I removed the code block as the CHR( 8 ) character shows without it within my browser)

There is a CHR( 8 ) added before the ";"?

This ONLY happens when this particular function is folded?


Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

attach the file, please.

bigsofty

I just stopped using code folding for the present.

I can't post the whole program Gernot, its part of a commercial product so I will cut out the function and its types, then mail it to you Gernot.

Cheers,


Ian
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Slydog

I notice when you fold code, it replaces all [CR][LF] pairs with [BS][FF]  (ascii 08 & 12).
Looks like a bug in the 'folding' / 'unfolding' code and is two characters off somewhere.
(does the line end with [CR][LF] when NOT folded?  may be saved in a different format somehow?)

Does the compile error happen if you have a comment at the end?  (ie. push the problem to the right more)
Is it the same error if you remove the % from rand?  (it may insert the [BS] character in another position then).

And why not use 'INC tot%, rand%'.  (not as pretty, I guess, but I assume it converts to 'tot += rand' in c++.)
(just nit-picking, ignore this!! ha)
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

matchy


bigsofty

Gernot I PM'ed you the code regard this error.

Cheers,


Ian
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

OK, fixed next update. Thanks.