Article View: gnu.g++.bug
Article #544char * = void * not error?
From: John T Riedl
Date: Tue, 24 Oct 1989 19:58
Date: Tue, 24 Oct 1989 19:58
36 lines
1420 bytes
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
Technical Details
Message-ID:
<RIEDL.89Oct24145832@medusa.cs.purdue.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!purdue!riedlShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!purdue!riedl From: riedl@cs.purdue.EDU (John T Riedl) Newsgroups: gnu.g++.bug Subject: char * = void * not error? Message-ID: <RIEDL.89Oct24145832@medusa.cs.purdue.EDU> Date: 24 Oct 89 19:58:32 GMT Sender: riedl@cs.purdue.EDU Distribution: gnu Organization: Department of Computer Science, Purdue University Lines: 36