Haha well I never liked that idiom but I recently found out that #ifdef was present in the first CPPs whereas #if was much later. So that's why #ifdef notdef is seen a lot in old code. Anyway, personally I use #if 0 and #if 1 quite a lot for debugging or questionable stuff. For a while, I was quite into the idea of doing compile time options like #define SOME_OPTION 1 and then using #if SOME_OPTION, as I felt it was nicer than #ifdef SOME_OPTION. But I've changed my mind, as this is pretty nonstandard usage and can be misleading. It's also not really safer than #ifdef, since for some reason CPP accepts undefined symbols and treats them as 0 in a #if statement. Go figure. cheers, Nick On Thu, Feb 9, 2017 at 11:18 PM, Brantley Coile wrote: > That’s a good convention. I use the convention that the permanent comments use the slash-splat form and the slash-slash from is used for temporary comment that will need attention later. They are TODO comments. > > I also use empty comments in the first column to note debugging stuff to remove laters. For example: > > void > main(int argc, char **argv) > { > ARGBEGIN { > default: > usage(); > } ARGEND > /**/ print(“argc=%d argv=%p\n”, argc, argv); > /**/ if (argc == 3) > /**/ print(“that funny number again\n”); > if (argc == 0) { > usestdin(); > … > } > > This lets the flow of the test logic clear yet is easy to find and remove the code later. > > I also use “#ifdef notdef” to comment out blocks of code. Have done since v7 days. Once I worked with a guy who saw the ifdefs and wondered what the function was that was def’ed out. He added -Dnotdef and all hell broke out! > > Brantley > >> On Feb 8, 2017, at 11:55 PM, Steve Johnson wrote: >> >> 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. >> >> Steve >> >> >> >> ----- Original Message ----- >> From: >> "Steve Nickolas" >> >> To: >> "The Eunuchs Hysterical Society" >> Cc: >> >> Sent: >> Wed, 8 Feb 2017 21:47:49 -0500 (EST) >> Subject: >> Re: [TUHS] // comment in C++ >> >> >> On Thu, 9 Feb 2017, Dave Horsfall wrote: >> >> > On Wed, 8 Feb 2017, Steve Johnson wrote: >> > >> >> I remember some discussion about this. In reality, a C comment really >> >> requires you to type 8 characters, because putting anything adjacent to >> >> the /* or */ looks terrible. Many languages used single characters >> >> (e.g., # for make). The argument was "if you make comments easier to >> >> type, you'll get more of them in the code" (viz. the Unix kernel). I'm >> >> guessing Bjarne was aware of these discussions, although I don't >> >> remember specifically that he was... >> > >> > My favourite C /* */ style is this: >> > >> > /* >> > * foo >> > * bar >> > */ >> >> This is the way I usually write my comments, too. >> >> > Is that what you meant? And recent C also accepts // as a comment, which >> > I use like this: >> > >> > /* >> > * This is where we do some neat stuff. >> > */ >> > foo(); >> > weird_function(); // Yes, we need to call this here... >> > bar(); >> > >> > I'm quite taken by BIND, though, which accepts >> > >> > /* this */ >> > // this >> > # and this. >> >> Unrealircd likewise accepts those 3 different types of comments. >> >> -uso. >