Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jens Gustedt Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: C as a Subset of C++ (or C++ as a superset of C) Date: Tue, 28 Aug 2012 09:27:54 +0200 Organization: A noiseless patient Spider Lines: 21 Message-ID: <503C72FA.2090109@loria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="2590e4fa64e7931a8f955de6703c052f"; logging-data="18200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Yr9seob1cB1uNoB5ncXkYL7dszJEhMIc=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 In-Reply-To: Cancel-Lock: sha1:0132ZzwlXC767Deviu3JgJGPIqY= Xref: csiph.com comp.lang.c:25198 comp.lang.c++:17970 Am 28.08.2012 05:34, schrieb BGB: > On 8/27/2012 9:47 PM, Casey Carter wrote: >> and (c) both languages use a new distinct type >> that can implicitly convert to any pointer type. > > we call this 'void *', where this is nearly the only thing that can > really be done with this type anyways ("void" variables are otherwise > pretty much useless, ...). yes! That said, I don't really see the point of "void*" as it is in C++ nowadays. Since you'd have to do an explicit conversion any time you use it, in C++ it has nothing that couldn't be done with a "unsigned char*". In the contrary, "unsigned char*" allows byte based pointer arithmetic and to inspect the contents on a byte base. The only reason, I think, for "void*" is interface compability to C. Somehow it misses the whole point of it. Jens