OPs "multilevel" comments (i.e. the fact (* *) takes precedence over the other block-comment { and } is a boon. When debugging a larger block i can comment out small ones and then comment out the whole block containing these smaller block comments.

OPs "multilevel" comments (i.e. the fact (* *) takes precedence over the other block-comment { and } is a boon. When debugging a larger block i can comment out small ones and then comment out the whole block containing these smaller block comments.

I remember showing this to people using other languages and they got pretty impressed. But this was a loooong time ago.

Anyone has a hang on if this still is something to brag about for OP?

Comments

  1. AFAIK Turbo/Borland C++ supports nested comments just by using /* and */. That would've been better than having to use different symbols but hey... it's better than nothing :)

    ReplyDelete
  2. Jimmy H 
    You mean i can write:

    /*
    line1
    /*
    line2
    line3
    */
    line4
    */

    and line 4 will be commented? In that case awsome, did not know that.

    If you do this in OP, i.e:

    {
    line1
    {
    line2
    line3
    }
    line4
    }

    that won't compile.

    Let's hope i'll not regret not checking things out before i write :)

    ReplyDelete
  3. In Delphi, `Ctrl+/` is your friend: select a whole bunch of lines and it toggles // comments on all of them at once.

    ReplyDelete
  4. Jeroen Wiert Pluimers but i already have //'s in the small blocks. Think debugging multithreaded stuff and 3rd party code (suspecting it's there too) at the same time...

    ReplyDelete
  5. Dany, try the Ctrl+/. Delphi will add extra // in front of the existing // when you're doing a multi line selection.

    ReplyDelete
  6. Jimmy H Thanks for stressing that, as it was exactly what I meant: the IDE adds // at the start of the line when not all selected lines start with // (even doubling the lines that did start with //). When all selected lines start with //, it removes them (restoring the prior situation). So you can use Ctrl+/ as a toggle.

    ReplyDelete
  7. IDE is great!

    But I prefer the (* ) way because next day at work i can clearly see what i was up to last night :) Also for things "legacy" four or five // // // is beaten by the clarity of using ( *). I have seen such nesting...

    Thank's for the hints, though!

    ReplyDelete
  8. for last night, you have DVCS, especially if you're not the only one using (* *) comments.

    ReplyDelete
  9. True, Jeroen Wiert Pluimers i use that too :)

    ReplyDelete

Post a Comment