Re: False positive warning: missing return statement and switch statements

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

 



On Tuesday 15 November 2005 22:26, Steven L. Zook wrote:
> What happens when someone calls with:
>
> toInt( (Number)3 );
>
> C/C++ lets you cast any numeric to an enum.

Indeed. I think it's easy to deliberately break code which gcc doesn't warn 
for. If the programmer decides to by pass static type checking and (ab)use an 
enumerator by not using it for what it is but as a plain integer -- then I 
expect it to break(no return value at runtime). After all, if one want 
arbitrary integers: then use an integer, not an enum.

As I see it, the whole point with enumerators is static type checking safety. 
The warning counter-acts this by giving false positives for those who use 
enumerators properly(that is, they don't store arbitrary integers in them).

Obviously, I am looking at this the wrong way -- please explain.


Cheers,

		Frans

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux