[PRL] safe c project for beginners?

Jed Davis jld at ccs.neu.edu
Wed Nov 24 15:31:35 EST 2010


On Fri, Nov 19, 2010 at 11:47:56AM -0800, Joe Marshall wrote:
> I had to laugh when I saw `C' juxtaposed with the word `safe'
> in the subject line.

I can't say that was quite my reaction when I saw "C" juxtaposed with the
word "safe" in the PLDI'09 proceedings, in the paper title
_Implementation of the memory-safe full ANSI-C compiler_
( http://portal.acm.org/citation.cfm?id=1542505 )
( One-line summary: for all the nasal demons in ANSI C, forbid them.)

> First, always turn on every single compiler warning you possibly can.  (BUT
> don't turn on warnings that trigger on the standard include files.)  Then always
> make sure that your code compiles with *exactly* zero warnings.  This will
> save you a whole bunch of grief.

This approach is so useful that some C compilers have an option to treat
all warnings as errors (e.g., GCC) or even to selectively errorize
individual warnings (e.g., halfway-recent GCC).  I quite recommend
using them if you are not preparing an IOCCC entry.

> (And annoy you to no end.  But I guarantee the number of mysterious
> crashes will decrease dramatically.)

Oh, I think the annoyance will go away pretty quickly after the first few
embarrassingly stupid mistakes get caught at compile time.

-- 
.text
.ascii "h<8[X]hO2:>TXhxY-1T[hv]?xTY1(1+1)jOT_^j1!7[j4!7XjE17ZRQSSSPX]"
.long -85229363



More information about the PRL mailing list