🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1146

Re: void * (was: Is "void f(int i) { return (void)i; }" legal?)

#1146
From: Doug Gwyn
Date: Sat, 14 Apr 1990 02:07
13 lines
1328 bytes
In article <1841@ambush.dk> andrew@ambush.dk (Leif Andrew Rump) writes:
>it is a bit puzzling at first to see that void * is legal but I sure
>rather want that than char * as it was in malloc and other in the past

The trick is to realize that there are no void objects; void denotes
an incomplete type that cannot be completed!  Thus when a pointer of
type void * points to some object, the type of the pointed-to object
cannot be void but must be determined in some other way.  The standard
library routines have void * parameters when they are expected to be
used to operate with a variety of different actual object types.
Since objects are made up of bytes, we COULD have continued to use
char * to point at arbitrary objects, but void * permits stronger type
checking, and that was considered to be a Good Thing.
Technical Details
Message-ID: <12589@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!apple!bionet!ames!haven!adm!smoke!gwyn
References: <261E9779.25257@paris.ics.uci.edu> <1841@ambush.dk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!apple!bionet!ames!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: void * (was: Is "void f(int i) { return (void)i; }" legal?)
Message-ID: <12589@smoke.BRL.MIL>
Date: 14 Apr 90 02:07:15 GMT
References: <261E9779.25257@paris.ics.uci.edu> <1841@ambush.dk>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 13