🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #13074

Re: Abusing pointers (was: Availabl

#13074
From: kaiser
Date: Tue, 24 Feb 1987 04:16
23 lines
1684 bytes
Concerning some fancy pointer referencing stuff, michael@crlt.UUCP asks :

>I have heard that this is used in a number of kernels, and of course it
>would work in a lot of compiler-generated code that didn't do tricks with
>registers or storage allocation, and didn't waste a lot of processor and
>programmer effort trying to "protect" you against your folly, but where
>do K&R come out and say it is legal?  I just re-read the source I think
>would be the most likely place (the "pointers" chapter of the sky-blue
>C book) and didn't find it.

In section 14.1 of the K&R C Reference manual (Structures and Unions)
we find the loophole. In a reference to a structure, you are 
supposed to reference of of that structures components; but
"to allow an escape from the typing rules" (or perhaps to simplify
writing the early C compilers?) the restriction is not enforced.

The section is concluded with "Such constructions are non-portable.",
which pretty much summarizes it.  The compiler writer may take
poetic license with such strange constructs.

Roger Kaiser
uiucdcsp!kaiser
Technical Details
Message-ID: <76700004@uiucdcsp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!inuxc!pur-ee!uiucdcs!uiucdcsp!kaiser
References: <646@crlt.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!inuxc!pur-ee!uiucdcs!uiucdcsp!kaiser
From: kaiser@uiucdcsp.UUCP
Newsgroups: comp.arch
Subject: Re: Abusing pointers (was: Availabl
Message-ID: <76700004@uiucdcsp>
Date: Mon, 23-Feb-87 23:16:00 EST
Article-I.D.: uiucdcsp.76700004
Posted: Mon Feb 23 23:16:00 1987
Date-Received: Fri, 27-Feb-87 23:00:26 EST
References: <646@crlt.UUCP>
Lines: 23
Nf-ID: #R:crlt.UUCP:646:uiucdcsp:76700004:000:1079
Nf-From: uiucdcsp.cs.uiuc.edu!kaiser    Feb 23 22:16:00 1987