Article View: gnu.g++.bug
Article #392null pointers to members
From: James Clark
Date: Tue, 05 Sep 1989 08:00
Date: Tue, 05 Sep 1989 08:00
33 lines
1349 bytes
1349 bytes
cfront guarantees that a valid pointer to member is not equal to zero
(it adds 1 to the offset); g++ 1.35.1- doesn't:
Script started on Tue Sep 5 08:55:32 1989
$ cat test.c
#include <stdio.h>
struct A {
int n;
};
main()
{
auto A::*ptr = &A::n;
if (ptr == 0)
puts("zero pointer to member");
}
$ g++ -g -v test.c
g++ version 1.35.1-
/usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ test.c /tmp/cca04660.cpp
GNU CPP version 1.35
/usr/local/lib/gcc-cc1plus /tmp/cca04660.cpp -quiet -dumpbase test.c -noreg -version -G -o /tmp/cca04660.s
GNU C++ version 1.35.1- (sparc) compiled by GNU C version 1.35.
/usr/local/lib/gcc-as /tmp/cca04660.s -o test.o
/usr/local/lib/gcc-ld++ -C /usr/local/lib/crt0+.o test.o -lg++ /usr/local/lib/gcc-gnulib -lg -lc
$ a.out
zero pointer to member
$
script done on Tue Sep 5 08:55:53 1989
James Clark
jjc@jclark.uucp
Technical Details
Message-ID:
<8909050800.AA04671@jclark.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!jclark!jjcShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!jclark!jjc From: jclark!jjc@UUNET.UU.NET (James Clark) Newsgroups: gnu.g++.bug Subject: null pointers to members Message-ID: <8909050800.AA04671@jclark.uucp> Date: 5 Sep 89 08:00:58 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 33