Article View: comp.std.c
Article #4545Re: Alignment of malloc()
From: Michael Spertus
Date: Tue, 02 Jan 1996 18:43
Date: Tue, 02 Jan 1996 18:43
32 lines
1654 bytes
1654 bytes
In article <j66Sx*FRe@yaps.rhein.de>, Arno Eigenwillig <arno@yaps.rhein.de> wrote: > >That is a quality-of-implementation issue and hence beyond the scope >of The Standard. All The Standard defines in the end is the output a C >program creates, not the timing nor (thanks to the as-if rule) the way >it creates it. > My question is what the committee means by the words "proper alignment". If "proper" COMPLETELY ignores efficiency consideration even if they are gross, it means that I would have to align all malloc() returns according to the size of the data in all portable code I write. However, I've never seen an "ANSI C" textbook that advises aligning malloc() returns by hand. So the interpretation that completely ignores reasonable efficiency expectations is incompatible with the way people are taught to code portably in C. For this reason, the two possibilities are: 1) All the texts (including K & R) are advocating code that is not reasonable on (the most common) compliant implementations of C. or 2) 32 bit alignment of malloc() on PCs is not compliant. Either possibility is very serious, and violates assumptions that most programmers take for granted Regards, Mike
Technical Details
Message-ID:
<DKKHCH.L6r@midway.uchicago.edu>Path:
arc1-ca.pugleaf.net!vixen.cso.uiuc.edu!uchinews!newsReferences:
<DKDA7D.Kw7@midway.uchicago.edu> <j66Sx*FRe@yaps.rhein.de>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!vixen.cso.uiuc.edu!uchinews!news From: Michael Spertus<mps@geodesic.com> Subject: Re: Alignment of malloc() X-Nntp-Posting-Host: ford.uchicago.edu Message-ID: <DKKHCH.L6r@midway.uchicago.edu> Sender: news@midway.uchicago.edu (News Administrator) Organization: Dept. of Mathematics References: <DKDA7D.Kw7@midway.uchicago.edu> <j66Sx*FRe@yaps.rhein.de> Date: Tue, 2 Jan 1996 18:43:28 GMT