[auton-users] New gcc problems

Dan Pelleg dpelleg+ at cs.cmu.edu
Mon Jul 22 18:06:22 EDT 2002


Andrew W. Moore writes:
 > Okay, I am convinced by Dan...we should also disallow // comment chars.
 > So my vote is in favor of setting the default to pedantic mode.
 > 
 > Does anyone have the ability to write an ingenious script to automatically
 > turn all the current //'s into /* .. */'s?
 > 
 > Andrew



I've actually done that for quite a bit of code. There are still files I
wasn't using at the time, and so weren't modified. To see which ones they
are, do this in your h/ directory:

fgrep -l "//" */*.[ch]

To fix a single file, in emacs:
M-x query-replace-regexp //\(.*\) <RETURN> /* \1 */ <RETURN>


// Note that it'll make comment blocks
// that look like this
// very ugly


/*  Note that it'll make comment blocks */
/*  that look like this */
/*  very ugly */

A script, well, this one here should do it (I didn't test it), but I would
advise against using scripts on code. For example, there are several URLs
in there, and we don't particulary want our users to see welcome messages
of the form:

please log on to http:/* www.autonlab.org */


******************************
AN UNTESTED SCRIPT THAT'LL POTENTIALLY CHANGE ALL OF YOUR SOURCE
FILES AND MAKE THEM UNCOMPILABLE:


perl -i.bak -e 's#//(.*)#/* \1 */#' */*.[ch]




More information about the Autonlab-users mailing list