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

  1. Path: sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!Germany.EU.net!mikros!mwtech!martin
  2. From: martin@mwtech.UUCP (Martin Weitzel)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Struct hack one last time (one last time)
  5. Message-ID: <1376@mwtech.UUCP>
  6. Date: 11 Jan 93 10:28:42 GMT
  7. References: <1992Dec31.153931.7495@hubcap.clemson.edu> <1993Jan1.173852.26630@taumet.com> <1993Jan7.145117.8220@jarvis.csri.toronto.edu> <1993Jan8.184304.10965@taumet.com>
  8. Reply-To: martin@mwtech.UUCP (Martin Weitzel)
  9. Organization: MIKROS Systemware, Darmstadt/W-Germany
  10. Lines: 21
  11.  
  12. In article <1993Jan8.184304.10965@taumet.com> steve@taumet.com (Steve Clamage) writes:
  13. [...]
  14. :The compiler is allowed to recognize calls to standard library functions.
  15. :It could fix up the returned struct after the call to malloc (or realloc
  16. :or calloc).  It would also have to interpret the size in case an array
  17. :were being allocated:
  18. :    extern size_t s;
  19. :    struct w *p = malloc(s);
  20. :    /* fixup s/sizeof(struct w) structs here */
  21. :
  22. :You could subvert this via void* pointers, but that isn't the point.
  23. :Presumably this is an optional checkout mode, and such modes typically
  24. :impose constraints on programmers.  If you play games to subvert type
  25. :checking, you are going to have problems.
  26.  
  27. Wait, wait, I think this argument is not quite fair.  I could proceed
  28. along the same path claiming a conforming program should not use setjmp/
  29. longjmp because I may envision some implementation which provides an
  30. optional checkout mode for programs that avoid setjmp, etc, etc.
  31. -- 
  32. Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83
  33.