Re:The //* /*/ //*/ comment toggle trick
by coherentpony on Monday April 29, 2013 @09:46AM
(#5626083)
This will compile to different things depending on whether you are using a C or a C++ compiler. Worse, it may compile to different things depending on which standard you compile to. If you don't want you colleagues to hate you, you should probably use:
Or, better yet, if it really is test code then write a test.
[ Parent
| on HN ]
I don't understand why someone would do this nested comments thing. This is what macro block are for...
And tests need to be separated from the code. Hopefully using a test framework.
If your code changes depending on if it is in 'test mode' or not (which is what is proposed), then the test code is not the same as the production code, i.e. the production code is not tested. I'm not just talking about timing issues - extra variable names and objects will be in scope in 'test mode', and might logically change the behavior of the program.
Re:The //* /*/ //*/ comment toggle trick
by alexanderbrevig on Monday April 29, 2013 @11:34AM
(#5626815)
* not all languages have macros
* you don't use test frameworks for enabling and disabling code inline while you're developing
Please read the protip, understand my intention (keyword TRICK) and have a delightful cup of coffee. You've earned it.
Welcome to Hacker News. :-)
> understand my intention
We don't do that here. However, we do have an unparalleled menu of pedantic critique, edge case obsession, and a wonderful sauce made from insanely perfect standards.