🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3353

Re: Struct hack one last time (one last time)

#3353
From: Martin Weitzel
Date: Mon, 11 Jan 1993 10:28
21 lines
1641 bytes
In article <1993Jan8.184304.10965@taumet.com> steve@taumet.com (Steve Clamage) writes:
[...]
:The compiler is allowed to recognize calls to standard library functions.
:It could fix up the returned struct after the call to malloc (or realloc
:or calloc).  It would also have to interpret the size in case an array
:were being allocated:
:	extern size_t s;
:	struct w *p = malloc(s);
:	/* fixup s/sizeof(struct w) structs here */
:
:You could subvert this via void* pointers, but that isn't the point.
:Presumably this is an optional checkout mode, and such modes typically
:impose constraints on programmers.  If you play games to subvert type
:checking, you are going to have problems.

Wait, wait, I think this argument is not quite fair.  I could proceed
along the same path claiming a conforming program should not use setjmp/
longjmp because I may envision some implementation which provides an
optional checkout mode for programs that avoid setjmp, etc, etc.
-- 
Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83
Technical Details
Message-ID: <1376@mwtech.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!Germany.EU.net!mikros!mwtech!martin
References: <1992Dec31.153931.7495@hubcap.clemson.edu> <1993Jan1.173852.26630@taumet.com> <1993Jan7.145117.8220@jarvis.csri.toronto.edu> <1993Jan8.184304.10965@taumet.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!Germany.EU.net!mikros!mwtech!martin
From: martin@mwtech.UUCP (Martin Weitzel)
Newsgroups: comp.std.c
Subject: Re: Struct hack one last time (one last time)
Message-ID: <1376@mwtech.UUCP>
Date: 11 Jan 93 10:28:42 GMT
References: <1992Dec31.153931.7495@hubcap.clemson.edu> <1993Jan1.173852.26630@taumet.com> <1993Jan7.145117.8220@jarvis.csri.toronto.edu> <1993Jan8.184304.10965@taumet.com>
Reply-To: martin@mwtech.UUCP (Martin Weitzel)
Organization: MIKROS Systemware, Darmstadt/W-Germany
Lines: 21