🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1265

Re: low-level knowledge of your friendly neighbourhood C compiler

#1265
From: Ken Raeburn
Date: Thu, 03 May 1990 01:27
32 lines
2388 bytes
|> henley@motcid.UUCP (Aaron Henley) writes:
|> >I think people should and in many cases must be aware of how their compiler
|> >allocates memory for structures, what happens when you typecast a
word from a
|> >memory location starting at a point that isn't word aligned, etc... 
These and
|> >many other usages of C are ambiguously defined.

A reasonable statement, except that "ambiguously defined" is perhaps not
the technically correct term.  In the standard they are undefined,
implementation-defined, et cetera.

In article <1990May2.150837.946@jarvis.csri.toronto.edu>,
	flaps@dgp.toronto.edu (Alan J Rosenthal) writes:
|> This is completely wrong.  These things are UNDEFINED, not at all ambiguous.
|> The following two statements are both unambiguously false:
|> 	a) dereferencing a misaligned pointer in C dumps core; and
|> 	b) dereferencing a misaligned pointer in C doesn't dump core.
|> That's what undefined means.  It doesn't mean that one of them is true.

It also does not mean that they are false.  It means that you cannot
determine (without more information, if at all) the truth of either of
them, or even whether "to dump core" will have meaning in a particular
context.

Aaron was referring to "the implementation of C on the programmer's
commonly used platform", not "C in the abstract, as defined by the
standard".  This seems clear from his mention of "how their compiler
allocates memory for structures"....  In the specific case, either one
of the statements you suggest could be true.  He was suggesting that
programmers find out what the implementation-defined results are.
Technical Details
Message-ID: <1990May3.012757.7980@athena.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!sdd.hp.com!think!snorkelwacker!bloom-beacon!athena.mit.edu!raeburn
References: <1990Apr25.180007.13243@cunixf.cc.columbia.edu> <12694@smoke.BRL.MIL> <2647@mica6.UUCP> <1990Apr28.232221.20725@utzoo.uucp> <2700@mica6.UUCP> <1990May1.165701.4289@utzoo.uucp> <2746@mica6.UUCP> <1990May2.150837.946@jarvis.csri.toronto.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!sdd.hp.com!think!snorkelwacker!bloom-beacon!athena.mit.edu!raeburn
From: raeburn@athena.mit.edu (Ken Raeburn)
Newsgroups: comp.std.c
Subject: Re: low-level knowledge of your friendly neighbourhood C compiler
Message-ID: <1990May3.012757.7980@athena.mit.edu>
Date: 3 May 90 01:27:57 GMT
References: <1990Apr25.180007.13243@cunixf.cc.columbia.edu> <12694@smoke.BRL.MIL> <2647@mica6.UUCP> <1990Apr28.232221.20725@utzoo.uucp> <2700@mica6.UUCP> <1990May1.165701.4289@utzoo.uucp> <2746@mica6.UUCP> <1990May2.150837.946@jarvis.csri.toronto.edu>
Sender: news@athena.mit.edu (News system)
Reply-To: Ken Raeburn <Raeburn@MIT.Edu>
Organization: MIT Project Athena
Lines: 32