This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C: Proposal: Warning using char* a; if(a == "")


> Please add the following line maybe?:
>
> 	Proceed to compile? [yes/no] (please type literally):
>

You want the programmer to type the word literally?
And how will typing the word literally all the time answer that question?

I think a better warning would be the factual one along the lines that
root and "\\", being statically addressed evaluate to a constant expression  
which branches only one way. Something like:

warning: conditional is constant

It would also apply to things like: if(1) {}

But not to things like astring == bstring which makes sense to compare two  
variable string pointers. Personally, I leave all sorts of warnings in my  
code just to remind me of some sensitive cross-platform issues with our code.  
I wouldn't want to be asked a question by the compiler the 1000 times a day  
I recompile (if that is what you mean). This is the first time I read this  
thread so I can be way of base...

Thanks A Bunch! David Young; VVI-DCS
dyoung@vvi.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]