4 ms·
My thoughts, exactly. Perhaps I'm a little overly pedantic, but it annoys me to extremes when I find c++ style comments littering up c
by jmj42 15y ago
My thoughts, exactly. Perhaps I'm a little overly pedantic, but it annoys me to extremes when I find c++ style comments littering up c
- burgerbrain 15y agoWhat I do is I turn on my compilers warnings for C++ comments in C code, then use C++ comments with all my TODO comments. That way I know if there are any outstanding TODOs when I go to build.
- mahmud 15y agoIt's not a warning in GCC. The -ansi flag, and older standards, err on C++ comments, but they're still valid input for C99 mode(s).
- burgerbrain 15y agoWith -pedantic you can get: warning: C++ style comments are not allowed in ISO C90 [enabled by default] Might be worth noting at this point since I'll already halfway though the GCC manpage again, that -Wcomments seems to be exactly for the sort of situation the author of the article found himself in.
- acqq 15y agoIt depends on what you write. If your goal isn't portability, using // has nothing to do with author's unawareness of the semantics of the line continuation character in C (that is, escaped line end character). It's a C feature since forever, and not knowing about it would bite him sooner or later even without the use of C++ comments.