Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: const vs. void Message-ID: <631@taumet.com> Date: 21 Mar 91 18:48:50 GMT References: <1991Mar20.164518.19928@intelhf.hf.intel.com> Organization: Taumetric Corporation, San Diego Lines: 20 ajw@watson.hf.intel.com (Alan Waldock) writes: >If, to protect data, I point to it with a 'char const *', the >compiler prevents me from using that pointer as the first (destination) >argument to 'strncpy()', which requires a 'char *'. >However, I'm free to pass it (as destination) to 'memcpy()', which >specifies a 'void *' as its first argument. >It's as if a 'void *' will accept any pointer, const or no. Is this right? Until recently, any pointer could be implicitly converted to void*, including a pointer to const. The ARM now specifies that the conversion will not occur, and the call to memcpy() will fail without an explicit cast. I believe cfront 2.1 enforces this new restriction. -- Steve Clamage, TauMetric Corp, steve@taumet.com