From: Christian B. <chr...@gm...> - 2007-02-20 02:27:01
|
Bill Pringlemeir wrote: > On 19 Feb 2007, chr...@gm... wrote: > On the ARM "char" is unsigned char. See > "http://www.arm.linux.org.uk/docs/faqs/signedchar.php". This is a > real portability issue. If someone considers this an issue, he better stays away from C altogether. Gtk-Gnutella works fine on IRIX/MIPS where char is unsigned char. I didn't know that but I know that char can be signed or unsigned. Actually unsigned char causes less trouble with respect to integer promotion. Recently you posted some example code where this mattered and (unsigned char) casts where missing. What's really awkward on ARM is this: struct example { char c; }; sizeof(struct example) != sizeof(char) This differs from pretty much any other architecture in existence. So code that assumes char (or unsigned char) causes no structure padding is wrong. > I do agree that portions of the splint parser aren't correct. > Typically, I have to look at 100 warnings before I find a real bug. > But it usually takes less time to look at the 100 warnings than to > *find* and fix a bug. Sure, if you can limit the warnings to the kinds which are actually useful, it might be of use. > Splint can be used to find dead code and variable using inter-modular > analyze (and show little else). There are better commercial lint > tools. Splint is much better if you use the annotations; comments > that specify functionality. I never really liked lint tools because they work kind of "context-free" that is they don't even grasp as much as real compiler. Some of them are do not even know about C99. For example, I know that we have no static arrays in the code with more than 2^31-1 members, so an unsigned int will definitely be sufficient as iterator or index. lint tools require annotations. Well, "FALL THROUGH" is in many cases also helpful for the human reader but a lot of annotations just make the code ugly and are of little use. I almost consider lint tools as historic because in the past, C compilers emitted few warnings (if any) but GCC is nowadays very smart and emits mostly useful warnings. Also it has a lot of warnings that are not emitted by any lint tools. -- Christian |