f11 g++ behaviour
David L
idht4n at gmail.com
Tue Feb 24 22:32:08 UTC 2009
This is a bit off topic, but it's something I noticed
when logged into my f11 partition. An application
fails to compile that used to compile with f10.
I've condensed the problem to this:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char *gr;
const char *pl="BlahHello world!";
const char *gt="Hell";
gr = strstr(pl, gt);
printf("%s\n", gr);
return 0;
}
In f10, this compiles with g++. In f11, it compiles
with gcc, but not with g++. It fails with this error:
test.cpp:8: error: invalid conversion from 'const char*' to 'char*'
It seems a little odd that it fails since the man page
for strstr shows this signature:
char *strstr(const char *haystack, const char *needle);
I guess strstr is returning a pointer to a const char *,
so this error kind of makes sense. But I'm
not sure what's supposed to happen. Is this the
correct behaviour for g++ to fail and gcc to work
for this code?
Thanks,
David
More information about the fedora-test-list
mailing list