lua-users home
lua-l archive

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



On Jul 21, 2014 2:09 PM, "Dirk Laurie" <dirk.laurie@gmail.com> wrote:

> In gcc you have -Wparentheses, but beginners should be taught
> to compile everything with -Wall.

Does this help actual beginners? This is not just a rhetorical question; I started on C ~30 years ago too, and do not remember what it was like. But this was before you could cut&paste puzzling error messages into search engines and find a decade of people similarly puzzled.

-Wall does have great utility for intermediate programmers. If someone is familiar with the core model of C, they have some hope of understanding messages about argument promotion and unsigned types, for example.

When people ask me to help debug their C code, I ask that they clean up -Wall first if they can. Sometimes they can, and they find their bug in the process. Sometimes they can't clean up the warnings, which means we need to study the source code, the headers in use, and annoying details of the language spec. This can be useful to learn anyway.

After clean -Wall, I ask for clean valgrind, and that solves about 50% of the problems. This perhaps says more about the people I've worked with (often experts in other fields---people who have better things to do than learn C programming) than the language itself.

Jay