home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / std / c / 3331 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  933 b 

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!utcsri!dgp.toronto.edu!flaps
  2. Newsgroups: comp.std.c
  3. From: flaps@dgp.toronto.edu (Alan J Rosenthal)
  4. Subject: Re: Struct hack one last time (one last time)
  5. Message-ID: <1993Jan7.145117.8220@jarvis.csri.toronto.edu>
  6. References: <1992Dec31.153931.7495@hubcap.clemson.edu> <1993Jan1.173852.26630@taumet.com>
  7. Date: 7 Jan 93 19:51:17 GMT
  8. Lines: 11
  9.  
  10. steve@taumet.com (Steve Clamage) writes:
  11. >An implementation is allowed to add padding to the end of a struct.
  12. >Suppose that the implementation adds space to the end of each struct
  13. >type where it encodes information used for run-time error checking.
  14.  
  15. Can't do that... what happens when you malloc one of them?
  16.  
  17.     struct whatever *p = (struct whatever *)malloc(sizeof(struct whatever));
  18.  
  19. Immediately after the malloc, if p is not null you can start using the struct,
  20. but it won't have that run-time-error-checking information, so it will fault.
  21.