On Sun, 15 Jun 2008 11:16:38 -0500
Ryan Neufeld <[EMAIL PROTECTED]> wrote:
> Being new to "actual" development I have not heard or used of many
> of the tools you've mentioned. I'll make a point this week of
> looking into them and seeing what I can use to make my development
> better.
Valgrind you'll love (see alleyoop for a (slightly) prettier front end).
Sparse is easier to make happy then lint (lint gets a little annoying and you
need to work to make it happy). Pay particular attention to sparse and NULL/0
pointers ;-)
> As for warnings, I generally make a point of not having any.
I love that policy ;-) Not always possible unfortunately :-(.
> In the
> case of my Message not being initialized it turns out g++ didn't
> give me a warning. Forgive my naivety, but what flags can I set to
> increase/ show warnings that don't normally get shown. (FYI - I do
> see warnings for things like unused variables, etc.)
g++ should give you those warnings with -Wall and any non-zero level of
optimisation (either -O2 or -Os). Generally speaking for gcc and family you
need to turn on at least -O1, else it has has some bad habits:
- No warnings about unused & uninitialised vars
- Sometimes generates incorrect code on some archs
- No dead code elimination.
On the flip side:
x = 0;
if (x){
broken_but_syntactically_correct_code_here = 292;
}
With optimisation GCC will sometimes eliminate the whole if (x) branch and not
tell you about any problems in that code.
For C I use:
-Wall -Os -g3 -W -Wpointer-arith -Wno-unused-parameter -Wstrict-prototypes
-Wno-sign-compare
(No unused parameters as I use a lot of callbacks, no sign compare as that
generally comes from utf8 strings and silly optimisations).
-Wall is all the useful ones, -W is extra pedantic ones.
-Wpointer-arith is to suppress the gcc mis-feature of arithmetic on void *s.
-Os means optimise fairly aggressively but favour small size
-g3 means emit extra debug symbols.
-Wstrict-prototypes requires all functions be declared before they are
defined - like C++.
For C++ (CXXFLAGS):
-Wall -Os -g3 -W -Wpointer-arith -Wno-unused-parameter -Wno-sign-compare
Similar, except no -Wstrict-prototypes, as it is already part of C++.
> Thanks for both the help and the advice everyone.
Hope I wasn't too nasty ;-)
Regards,
nash
_______________________________________________
tp-devel mailing list
[email protected]
http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel