Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!apple!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!sci.kun.nl!atcmpe!leo From: leo@atcmp.nl (Leo Willems) Newsgroups: comp.lang.c++ Subject: void* cast Keywords: void * cast ANSI C++ Message-ID: <808@atcmpe.atcmp.nl> Date: 25 Nov 90 22:55:45 GMT Organization: AT Computing, Nijmegen, The Netherlands Lines: 30 In C++ it is not allowed to assign to a void* without a cast, in ANSI C however one may do so. int *pi; void *pv; C++: pi = (int*) pv; I always imagined why a cast was needed, the context made it clear an int* conversion was expected. I never could find an example for this difference untill I ran into this: C++: wait((int*)0); //SV wait((union wait*)0); //BSD ANSI C: wait((void*)0); //SV + BSD In my vision, the ANSI C example need not be portable. Is this a good example of the reason between the C++/ANSI C diff.? If it is not, can someone give me a good example? Thanks.