Article View: comp.lang.c.moderated
Article #2602Re: void* type
From: Chris Sonnack
Date: Tue, 16 Apr 1996 01:06
Date: Tue, 16 Apr 1996 01:06
22 lines
1669 bytes
1669 bytes
news@Thinkage.On.CA wrote: >> The standard actually says 7.10.3: >> >> "The pointer returned if the allocation succeeds is suitably aligned so >> that it may be assigned to a pointer to any type of object..." > > No, it only says that you can do the assignment, i.e., it won't cause a > trap or somesuch. The assignment itself might change the pointer value. > After the assignment eveything must be as we all expect. Imagine a malloc > that returns a pointer to a non-aligned byte, and the casting works by > rounding forward to the next alignment boundary. Which, as another poster points out, would force malloc() to "think ahead" and over-allocate, wouldn't it? The problem I see is what happens when you pass that adjusted pointer BACK to free()? -- Chris Sonnack <cjsonnack@mmm.com> http://eishcq.mmm.com Engineering Information Services/Information Technology/3M, St.Paul, Minn ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "The whole earth is in jail and we're plotting this incredible jailbreak."
Technical Details
Message-ID:
<4kurr3$aoj@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4jv7ge$d49@solutions.solon.com> <4k1q3p$5bj@solutions.solon.com> <4k619q$aq4@solutions.solon.com> <4kcmqc$p5f@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: cjsonnack@mmm.com (Chris Sonnack) Newsgroups: comp.lang.c.moderated Subject: Re: void* type Date: 15 Apr 1996 20:06:43 -0500 Organization: 3M/IT/EIS (St.Paul,MN 55144) Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4kurr3$aoj@solutions.solon.com> References: <4jv7ge$d49@solutions.solon.com> <4k1q3p$5bj@solutions.solon.com> <4k619q$aq4@solutions.solon.com> <4kcmqc$p5f@solutions.solon.com> Reply-To: cjsonnack@mmm.com (Chris Sonnack) NNTP-Posting-Host: solutions.solon.com X-Newsreader: TIN [version 1.2 PL2]