Re: Re: Can `cpp' strip off comments in C source code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Things are a little complicated. I've googled a sed script on:
http://sed.sourceforge.net/grabbag/scripts/remccoms2.sh.txt

But the script can't handle this testcase:
    printf("/*  Haha \n"); /* Haha */
	printf("//  Haha \n"); // Haha

I think a simple regular expression filter is not enough. A lexical parsing is required to ensure the results come out right in all cases.
A prefessional utility is more suitable than a script written by me since I am not an expert in ANSI C standard.

>AWK itself can do it, as can sed.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux