Menu

Whoa! Where do the comments go?

Help
George
2011-03-07
2013-05-30
  • George

    George - 2011-03-07

    Not sure if this is a GCGB editor glitch or something I'm doing wrong.  The latter is likely!

    I like to comment profusely.  I thought the ; symbol preceding a line denotes comment text.  I write most of my code as text but when I flip to view as icons (or when the code loads on program start-up automatically in icon-mode), then back to text, presto chango, the comments have vanished.  I'm not sure but I think the tabs (or spaces) I use to off-set logical groups vanish too.

    Any ideas?  In the meantime, pray for world stability! :)

     
  • Hugh Considine

    Hugh Considine - 2011-03-07

    That is the normal behaviour for GCGB - I probably should make it a bit more obvious.

    GCGB treats comments starting with ; differently to comments starting with '. Comments that start with ' are the ones that GCGB recognises as comments that have been added to the program manually, and it will preserve these and generally keep them in roughly the right place. However, GCGB uses ; to mark comments that it has inserted automatically to the text program. When it reads them, it discards them.

    The GCGB text editor doesn't work in the way you might expect. When you open a program, it is converted to icons, then the text editor converts it back to text. This means that ; comments are deleted, On Interrupts and Dim statements are moved to one block at the start of the program, and a few other odd things happen. The reason for doing it this way is to keep the internal code simpler, and to make sure that icon programs and text programs are treated identically. However, if you mainly edit programs using text, it might be better to use another editor. I normally use Notepad++, other good options for GCBASIC are Prithvi Development Studio, GCBIDE, or Crimson Editor.

    I hope this hasn't caused too much trouble or confusion!

     
  • Hugh Considine

    Hugh Considine - 2011-03-07

    One more thing I should add, GCGB also likes to control the indentation. When it reads a text program, it removes all indentation - then when it creates a text program, it automatically generates the indentation - one tab for each level of If, Do, Repeat, Sub, For, etc. Each block of comments will also have a blank line added before it. This is meant to show new programmers the value of using plenty of white space, but it's also another thing that might make you want to use Notepad++ or similar!

     
  • George

    George - 2011-03-07

    Thanks much for your explanation.  I did indeed notice the auto ; features remaining but not "mine".  All is good.

     
  • kent_twt4

    kent_twt4 - 2011-07-22

    Topic Closed because of spam.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.