www.delorie.com/djgpp/v2faq/faq053.html | search |
| Previous | Next | Up | Top |
#include <stdio.h> int main () { printf ("%d \n" 10 //* / 2 //*/ 1 ); return 0; }If you must have both -ansi and C++-style comments, use -lang-c-c++-comments preprocessor switch. Gcc doesn't accept the -lang-XXX switches on its command line, so you will have to use the -Wp option, like this:
gcc -c -Wp,-lang-c-c++-comments myprog.cAlternatively, you can add -lang-c-c++-comments to the
*cpp:
section of your lib/specs file (but that will make it permanent).
Bottom line: until the future ANSI/ISO C standard includes this as part of the C language, it's best to change those //
comments to C-style ones, if you really mean to write a C program.
The following SED command will convert a C program with C++-style comments into a valid C source, provided you don't have the string "//" in a character string:
sed "s?//\(.*\)?/*\1 */?" file.c > newfile.cSED can be found with the DJGPP archives on SimTel.NET, in the v2gnu directory.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)