f11 g++ behaviour

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

 



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

-- 
fedora-test-list mailing list
fedora-test-list@xxxxxxxxxx
To unsubscribe: 
https://www.redhat.com/mailman/listinfo/fedora-test-list

[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]

  Powered by Linux