Thread overview | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 01, 2002 nested comments? | ||||
---|---|---|---|---|
| ||||
Are nested multiline /* */ comments allowed in D? |
January 01, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | no. Use the version statement to block out sections. "Pavel Minayev" <evilone@omen.ru> wrote in message news:a0t1rg$kjn$1@digitaldaemon.com... > Are nested multiline /* */ comments allowed in D? > > |
January 01, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a0tbj5$ptm$1@digitaldaemon.com... > no. Use the version statement to block out sections. Unfortunately, version cannot comment out blocks with bad syntax - which is needed sometimes. For example, I occasionally start writing something, then decide to try another idea, but comment the unfinished block out rather than deleting it in case I'll revert back to it later... and such a block may have improper syntax (like "if(a == "). |
January 02, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | I've been considering making version more tolerant of bad syntax, but it is going to have to count { and } ! "Pavel Minayev" <evilone@omen.ru> wrote in message news:a0th24$svc$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a0tbj5$ptm$1@digitaldaemon.com... > > > no. Use the version statement to block out sections. > > Unfortunately, version cannot comment out blocks with bad syntax - which is needed sometimes. For example, I occasionally start writing something, then decide to try another idea, but comment the unfinished block out rather than deleting it in case I'll revert back to it later... and such a block may have improper syntax (like "if(a == "). > > |
January 02, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | That's perfect. Surely we can make the brackets nest correctly. Sean "Walter" <walter@digitalmars.com> wrote in message news:a0tv8q$15rd$1@digitaldaemon.com... > I've been considering making version more tolerant of bad syntax, but it is > going to have to count { and } ! > > "Pavel Minayev" <evilone@omen.ru> wrote in message news:a0th24$svc$1@digitaldaemon.com... > > "Walter" <walter@digitalmars.com> wrote in message news:a0tbj5$ptm$1@digitaldaemon.com... > > > > > no. Use the version statement to block out sections. > > > > Unfortunately, version cannot comment out blocks with bad syntax - which is needed sometimes. For example, I occasionally start writing something, then decide to try another idea, but comment the unfinished block out rather than deleting it in case I'll revert back to it later... and such a block may have improper syntax (like "if(a == "). |
January 02, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a0tv8q$15rd$1@digitaldaemon.com... > I've been considering making version more tolerant of bad syntax, but it is > going to have to count { and } ! Still... what's wrong with nested comments? It's really funny to see that, even though ANSI commitee didn't make them standart, most C++ compilers around have a switch which enables them. It's not so hard to implement, but could be a useful thing! |
January 02, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a0ujps$1iqj$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a0tv8q$15rd$1@digitaldaemon.com... > > > I've been considering making version more tolerant of bad syntax, but it > is > > going to have to count { and } ! > > Still... what's wrong with nested comments? It's really funny to see that, even though ANSI commitee didn't make them standart, most C++ compilers around have a switch which enables them. It's not so hard to implement, but could be a useful thing! I'd like to try using the version statement unless it really reaches a dead end. |
January 03, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> "Pavel Minayev" <evilone@omen.ru> wrote in message news:a0ujps$1iqj$1@digitaldaemon.com...
> > "Walter" <walter@digitalmars.com> wrote in message news:a0tv8q$15rd$1@digitaldaemon.com...
> >
> > > I've been considering making version more tolerant of bad syntax, but it
> > is
> > > going to have to count { and } !
> >
> > Still... what's wrong with nested comments? It's really funny to see that, even though ANSI commitee didn't make them standart, most C++ compilers around have a switch which enables them. It's not so hard to implement, but could be a useful thing!
>
> I'd like to try using the version statement unless it really reaches a dead end.
... And we have to resort to using a pre-processor!
BTW, I've used M4 for years to do stuff other preprocessors failed to do for me. I'll probably find uses for M4 with D as well. Perhaps weeding out code that should not be compiled is a valid use. Otherwise, all the code you feed in should get compiled, right?
-BobC
|
January 03, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert W. Cunningham | "Robert W. Cunningham" <rwc_2001@yahoo.com> wrote in message news:3C33BF45.187E8D57@yahoo.com... > BTW, I've used M4 for years to do stuff other preprocessors failed to do for > me. I'll probably find uses for M4 with D as well. Perhaps weeding out code > that should not be compiled is a valid use. Otherwise, all the code you feed > in should get compiled, right? Nope, version and debug statements don't compile the code if the condition is not satisfied. |
January 07, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> ha scritto nel messaggio news:a0th24$svc$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a0tbj5$ptm$1@digitaldaemon.com... > > > no. Use the version statement to block out sections. > > Unfortunately, version cannot comment out blocks with bad syntax - which is needed sometimes. For example, I occasionally start writing something, then decide to try another idea, but comment the unfinished block out rather than deleting it in case I'll revert back to it later... and such a block may have improper syntax (like "if(a == "). I also often need nested comments as a fast way to comment-out weird code. To me seems better to define a new style of comment to comment out big blocks of code (or a block of natural language description). This new "wipe-out" comment must be clearly visible and we can choose it can be nested (it's new, so noone should complain). I think to something like: >@@ .. big block of text, with nested >@@ and <@@ ... <@@ I like to think this comment must be at column 0, so it's easy to distinguish from normal code Ciao. |
Copyright © 1999-2021 by the D Language Foundation