Need an opinion from C++ folks

Jeffrey A Law law@cygnus.com
Wed Oct 28 14:22:00 GMT 1998


Is this a bug or not?


------- Forwarded Message

From:     Cristian Gafton <gafton@redhat.com>
To:       Jeffrey A Law <law@cygnus.com>
cc:       Richard Henderson <rth@cygnus.com>
Date:     Wed, 28 Oct 1998 13:55:30 -0500 (EST)
Subject:  egcs bug


Hi Jeff,

This is a weird one that is kind of frustrating for the C++ coders around
here...

It seems that the C++ compiler has some issues interpreting constructs
like (x ? "Ok" : "Nay")

Cristian
- --
- ----------------------------------------------------------------------
Cristian Gafton   --   gafton@redhat.com   --   Red Hat Software, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 UNIX is user friendly. It's just selective about who its friends are.

Script started on Wed Oct 28 18:46:59 1998
[root@bobby /]# cat foo.c

#include <stdio.h>

int foo(char *bar) {
    printf("%s\n",bar);
}

int main() {
    int x;
    
    x=0;
    foo("bar");
    foo(x ? "bar" : "foobar");
}
[root@bobby /]# gcc -o foo foo.c
[root@bobby /]# ./foo
bar
foobar
[root@bobby /]# g++ -o foo foo.c
foo.c: In function `int main()':
foo.c:13: passing `const char *' as argument 1 of `foo(char *)' discards qualif
iers
[root@bobby /]# g++ -version
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.92.17/specs
gcc version egcs-2.92.17 19981026 (gcc2 ss-980609 experimental)


------- End of Forwarded Message




More information about the Gcc-bugs mailing list