🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1596

Re: void*

#1596
From: Karl Heuer
Date: Wed, 15 Aug 1990 20:40
19 lines
1558 bytes
In article <13548@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes:
>That's why the implementation of memchr() along the lines I suggested should
>not include the standard header.  Indeed, I wouldn't include the relevant
>header in most implementations of standard library functions, since it
>usually isn't either necessary or useful to do so.

I would consider it bad style to take advantage of the same-representation
clause like that; I believe it was added to grandfather in the pre-ANSI code
that contained explicit declarations for functions like malloc().  I would
simply implement memchr() using `void *', with casts as appropriate.  It's a
minor wart.

For memchr(), you want the header anyway in order to get the definition of
size_t.  (You could get it from some other header, but why go out of your way
to be difficult?)  Even if this were not the case, I'd include it just to let
the compiler confirm that the prototype in the header agrees with that in the
source.

Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint
Technical Details
Message-ID: <17416@haddock.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!snorkelwacker!spdcc!ima!haddock!karl
References: <13530@smoke.BRL.MIL> <43.UUL1.3#5077@aussie.UUCP> <13548@smoke.BRL.MIL>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!snorkelwacker!spdcc!ima!haddock!karl
From: karl@haddock.ima.isc.com (Karl Heuer)
Newsgroups: comp.std.c
Subject: Re: void*
Message-ID: <17416@haddock.ima.isc.com>
Date: 15 Aug 90 20:40:35 GMT
References: <13530@smoke.BRL.MIL> <43.UUL1.3#5077@aussie.UUCP> <13548@smoke.BRL.MIL>
Reply-To: karl@kelp.ima.isc.com (Karl Heuer)
Organization: Interactive Systems, Cambridge, MA 02138-5302
Lines: 19