🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by James Clark Tue, 05 Sep 1989 08:00
null pointers to members
#392
Author: James Clark
Date: Tue, 05 Sep 1989 08:00
33 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads