Author Topic: Code Folding Error  (Read 2487 times)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2733
    • View Profile
Code Folding Error
« on: 2010-May-19 »
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

  • Guest
Re: Code Folding Error
« Reply #1 on: 2010-May-20 »
Yes, you need to unfold all functions before compiling...

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10790
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Code Folding Error
« Reply #2 on: 2010-May-20 »
paste the function. Works for me when quickly testing.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2733
    • View Profile
Re: Code Folding Error
« Reply #3 on: 2010-May-20 »
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?


« Last Edit: 2010-May-20 by bigsofty »
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)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10790
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Code Folding Error
« Reply #4 on: 2010-May-31 »
attach the file, please.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2733
    • View Profile
Re: Code Folding Error
« Reply #5 on: 2010-May-31 »
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)

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 932
  • KodeSource
    • View Profile
    • KodeSource
Re: Code Folding Error
« Reply #6 on: 2010-Jun-01 »
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]

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: Code Folding Error
« Reply #7 on: 2010-Jun-02 »
Code folding issue discussed here: http://www.glbasic.com/forum/index.php?topic=4499.0

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2733
    • View Profile
Re: Code Folding Error
« Reply #8 on: 2010-Jun-02 »
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)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10790
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Code Folding Error
« Reply #9 on: 2010-Jun-02 »
OK, fixed next update. Thanks.