home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / dsp / 3087 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.5 KB

  1. Xref: sparky comp.dsp:3087 comp.lang.c:20172
  2. Newsgroups: comp.dsp,comp.lang.c
  3. Path: sparky!uunet!taumet!steve
  4. From: steve@taumet.com (Steve Clamage)
  5. Subject: Re: Is this a Legal Way to Access a Specific Address?
  6. Message-ID: <1993Jan25.170044.20283@taumet.com>
  7. Keywords: DSP, C, ANSI, Fixed RAM
  8. Organization: TauMetric Corporation
  9. References: <1993Jan23.042626.991@verdix.com> <1993Jan23.181029.29389@uvm.edu>
  10. Date: Mon, 25 Jan 1993 17:00:44 GMT
  11. Lines: 24
  12.  
  13. >In article <1993Jan23.181029.29389@uvm.edu> wollman@sadye.emba.uvm.edu (Garrett Wollman) writes:
  14. >
  15. >The ANSI C standard
  16. >*does* guarantee (I believe, not having a copy handy) that there is
  17. >some flavor of integer that can be cast back and forth to a pointer
  18. >type. 
  19.  
  20. Not quite.  It is legal to cast an integer value to a pointer type,
  21. and legal to cast a pointer value to an integer type.  The results
  22. are implementation-defined, which means that such code is not portable.
  23.  
  24. Further, it is not guaranteed that there exists an integer type which
  25. is large enough to contain all the bits in a pointer.  For example,
  26. implementations with 48-bit pointers and 32-bit longs exist, and
  27. are allowed by the C Standard.  Similarly, there are implementations
  28. where pointers cannot contain all possible integer values, and this
  29. is also allowed.
  30.  
  31. Implementations commonly allow casting back and forth between ints
  32. (or longs) and pointers, but you have to check the compiler manual
  33. to see what is actually supported.
  34. -- 
  35.  
  36. Steve Clamage, TauMetric Corp, steve@taumet.com
  37.