pointer reference comparing with int in gcc 4.1.2

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

 



This file cannot compile with gcc 4.1.2, but with gcc3.4.5 it works well.

#include <stdio.h>
#include <string.h>

typedef char str_t[10];

void f(str_t const &s)
{
printf("sizeof s:%d\n",sizeof(s));
if(s)
printf("%s\n",s);
}
int main()
{
str_t s1;
strcpy(s1,"abc");
f(s1);
printf("bytes of int:%d\n\n", sizeof(int)); 
return 0;
}

The command:
g++ test.cc
The output:
test.cc: In function 'void f(const char (&)[10])':
test.cc:9: error: invalid operands of types 'const char (&)[10]' and 'int'
to binary 'operator!='

I didn't find any hint in gcc change notes about this.Is there any way to
handle this without changing my source code?


-- 
View this message in context: http://www.nabble.com/pointer-reference-comparing-with-int-in-gcc-4.1.2-tp21026658p21026658.html
Sent from the gcc - Help mailing list archive at Nabble.com.


[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