🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by John T Riedl Tue, 24 Oct 1989 19:58
char * = void * not error?
#544
Author: John T Riedl
Date: Tue, 24 Oct 1989 19:58
36 lines
1420 bytes
My understanding from reading Stroustrup is that the assignment of a
void pointer to a typed pointer requires a cast.  However, under G++
the following program:

void * v;
char * sb;

main()
{
	sb = v;
	v = sb;
}

yields

[ medusa : riedl ] g++ -v -Wall -c void.cc
g++ version 1.35.1-
 /usr/local/gnu/lib/g++-1.35.1.lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D_
_cplusplus -Dunix -Di386 -Dsequent -D__unix__ -D__i386__ -D__sequent__ -Wall voi
d.cc /tmp/cc002632.cpp
GNU CPP version 1.34
 /usr/local/gnu/lib/g++-1.35.1.lib/gcc-cc1plus /tmp/cc002632.cpp -quiet -dumpbas
e void.cc -Wall -noreg -version -o /tmp/cc002632.s
GNU C++ version 1.35.1- (80386, BSD syntax) compiled by GNU C version 1.34.
 as /tmp/cc002632.s -o void.o
[ medusa : riedl ]

That is, there are no errors.  AT&T's C++ says 

[ raid2 : riedl ] /p1/CC/CC -v -c void.C
CC  void.C:
"void.C", line 6: error: bad assignment type: char * = void *
1 error
[ raid2 : riedl ]

John
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