[TUHS] // comment in C++

Michael Kjörling michael at kjorling.se
Thu Feb 9 21:59:22 AEST 2017


On 8 Feb 2017 20:55 -0800, from scj at yaccman.com (Steve Johnson):
> Well, personally I use // for almost all comments in C/C++.  I
> reserve /* */ for commenting out blocks of code.   Since, for some
> reason, /* */ doesn't nest, if I stick to this style life is good.

#if 0 ... #endif also works, and nests if needed.

I didn't know that // was now accepted to begin a comment in C, but I
strongly suspect that any compiler modern enough to know about that
will know just as well about #if 0.

-- 
Michael Kjörling • https://michael.kjorling.semichael at kjorling.se
                 “People who think they know everything really annoy
                 those of us who know we don’t.” (Bjarne Stroustrup)



More information about the TUHS mailing list