home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / std / c / 3408 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.8 KB

  1. Path: 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
  2. From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Is this allowed in C?
  5. Message-ID: <1993Jan25.020122.22998@nntpd.lkg.dec.com>
  6. Date: 25 Jan 93 02:01:22 GMT
  7. References: <C17p4n.Dx8@undergrad.math.waterloo.edu> <1993Jan22.012502.5241@nntpd.lkg.dec.com> <C19Juw.7GL@undergrad.math.waterloo.edu>
  8. Sender: usenet@nntpd.lkg.dec.com (USENET News System)
  9. Reply-To: diamond@jit.dec.com (Norman Diamond)
  10. Organization: Digital Equipment Corporation Japan , Tokyo
  11. Lines: 20
  12.  
  13. In article <C19Juw.7GL@undergrad.math.waterloo.edu> bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
  14. >In article <1993Jan22.012502.5241@nntpd.lkg.dec.com>, diamond@jit533.jit.dec.com (Norman Diamond) writes:
  15. >> In article <C17p4n.Dx8@undergrad.math.waterloo.edu> bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
  16. >> >[...]
  17. >> The C standard guarantees that whenever malloc() succeeds (which you forgot
  18. >> to check), the value will point to storage suitably aligned for everything,
  19. >> including structs.  So (struct astruct *)store can indeed be used as a pointer
  20.  
  21. > My example wasn't clear on what I really meant. Lets change the malloc()
  22. >  line to:
  23. > store = malloc(sizeof(blah)+3) + 3;
  24. > /* so that store isn't guaranteed to be aligned for anything, except
  25. >  * chars (is this true?) */
  26.  
  27. The C standard guarantees that whenever malloc() succeeds, the value will
  28. point to storage suitably aligned for everything, ....
  29. --
  30. Norman Diamond                diamond@jit.dec.com
  31. If this were the company's opinion, I wouldn't be allowed to post it.
  32. Pardon me?  Or do I have to commit a crime first?
  33.