🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3291

Re: Is this allowed in C?

#3291
From: Norman Diamond
Date: Mon, 25 Jan 1993 02:01
20 lines
1841 bytes
In article <C19Juw.7GL@undergrad.math.waterloo.edu> bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
>In article <1993Jan22.012502.5241@nntpd.lkg.dec.com>, diamond@jit533.jit.dec.com (Norman Diamond) writes:
>> In article <C17p4n.Dx8@undergrad.math.waterloo.edu> bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
>> >[...]
>> The C standard guarantees that whenever malloc() succeeds (which you forgot
>> to check), the value will point to storage suitably aligned for everything,
>> including structs.  So (struct astruct *)store can indeed be used as a pointer

> My example wasn't clear on what I really meant. Lets change the malloc()
>  line to:
> store = malloc(sizeof(blah)+3) + 3;
> /* so that store isn't guaranteed to be aligned for anything, except
>  * chars (is this true?) */

The C standard guarantees that whenever malloc() succeeds, the value will
point to storage suitably aligned for everything, ....
--
Norman Diamond                diamond@jit.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Pardon me?  Or do I have to commit a crime first?
Technical Details
Message-ID: <1993Jan25.020122.22998@nntpd.lkg.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!usc!cs.utexas.edu!sun-barr!olivea!decwrl!pa.dec.com!engage.pko.dec.com!e2big.mko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
References: <C17p4n.Dx8@undergrad.math.waterloo.edu> <1993Jan22.012502.5241@nntpd.lkg.dec.com> <C19Juw.7GL@undergrad.math.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!usc!cs.utexas.edu!sun-barr!olivea!decwrl!pa.dec.com!engage.pko.dec.com!e2big.mko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
Newsgroups: comp.std.c
Subject: Re: Is this allowed in C?
Message-ID: <1993Jan25.020122.22998@nntpd.lkg.dec.com>
Date: 25 Jan 93 02:01:22 GMT
References: <C17p4n.Dx8@undergrad.math.waterloo.edu> <1993Jan22.012502.5241@nntpd.lkg.dec.com> <C19Juw.7GL@undergrad.math.waterloo.edu>
Sender: usenet@nntpd.lkg.dec.com (USENET News System)
Reply-To: diamond@jit.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
Lines: 20