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]

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


Hi,

would it be possible, that the following code generates a -Wall warning:

void GetDiskFreeSpaceA( char* root )
{
    if ((!root) || (root == "\\"))
                    ============
...

The underlined code is perfectly legal but IMHO never makes sense. It took
me a lot of time to hunt down this bug, so a little help by the compiler
would be nice. (I used egcs-2.91.60, if it is fixed already, I'm sorry 
having bothered you... )

(A la: 

"Warning! Expression has no effect! You probably wanted to use strcmp()"

)

Greetings,
Peter


---
Peter Schlaile  ***  eMail udbz@rz.uni-karlsruhe.de


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