home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20251 < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.7 KB  |  53 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!uunet.ca!canrem!telly!druid!darcy
  3. From: darcy@druid.uucp (D'Arcy J.M. Cain)
  4. Subject: Re: HALLOC and HUGE ptrs in Microsoft C
  5. Message-ID: <1993Jan27.232921.3693@druid.uucp>
  6. Date: Wed, 27 Jan 1993 23:29:21 GMT
  7. Distribution: world,local
  8. References: <1993Jan21.175608.4279@arizona.edu> <C1BFs8.6EF@ccu.umanitoba.ca>
  9. Organization: D'Arcy Cain Consulting
  10. Lines: 41
  11.  
  12. raskin@ccu.umanitoba.ca (Alan Raskin) writes:
  13. >Actually, I think that fwrite is one of the library routines that *will*
  14. >take huge pointers; according to an old QuickC manual, "a huge array can
  15. >be passed without difficulty to any of these [bsearch, fread, fwrite, halloc,
  16. >hfree, lfind, lsearch, mem* and qsort] functions in a compact-, large-, or
  17. >huge-model program."                                  ^^^^^^^   ^^^^^
  18.  ^^^^
  19.  
  20. That's the problem - it isn't consistent across all models.
  21.  
  22. >Because of the <expletive deleted> segmented-memory architecture of the Intel 
  23. >80x86 CPUs, which at times requires the use of the non-portable "near", "far" 
  24. >and "huge" keywords, the only way to write "portable" C would be to use 
  25. >#if defined ( MSDOS )  /* M_I86 is also defined by MSC; what about Borland? */
  26. __MSDOS__ is defined by Borland and I believe by MSC as well.
  27.  
  28. >.
  29. >.    halloc(...);
  30. >.
  31. >#else
  32. >.
  33. >.    malloc(...);
  34. >.
  35. >#endif
  36.  
  37. While I agree with you about segments (*) in this case why not just:
  38.  
  39. #ifdef __MSDOS__
  40. #define halloc malloc
  41. #endif
  42.  
  43. Just once at the top.
  44.  
  45. (*) Q: What's the difference between an IBM PC and a boat anchor?
  46.     A: Segment registers.
  47.  
  48. -- 
  49. D'Arcy J.M. Cain (darcy@druid.com)  |
  50. D'Arcy Cain Consulting              |   There's no government
  51. Toronto, Ontario, Canada            |   like no government!
  52. +1 416 424 2871          DoD#0082   |
  53.