[Bf-committers] new round of warning hunt : some goofy things i cant decide on

Stephen Swaney sswaney at centurytel.net
Sat Jun 4 18:10:50 CEST 2005

On Sat, Jun 04, 2005 at 07:29:04AM -0400, Vio wrote:

> Duh. I've heard somewhere that *casts* is a way to cheat the compiler, 
> but then again, if you  want your code to compile, what other choice 
> is there (besides hacking  the offending sources)?

No, casting is not cheating.  It is telling the compiler you know
( or think you know ) more about the code that it does.  Lying to
the compiler can confuse optimizations.

As for hacking the offending sources, in this case the source is ours.
Fixing warnings often helps keep the code portable to different platorms.

> I personally find signed/unsigned keywords more annoying than anything 
> else, but then again, I'm just a clueless newbie. 

Functions like sizeof() and strlen() return size_t or similar.
This is unsigned because the size of something is >= zero

> By the way, if using gcc, you may find the "-w" flag useful in such 
> situations ((separates the "unimportant" from what really is).

We are already using -Wall -W on most of our gcc platforms

Stephen Swaney			
sswaney at centurytel.net

More information about the Bf-committers mailing list