home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / vmsnet / internal / 1599 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.5 KB

  1. Path: sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32
  2. From: Yaacov Fenster @ISO 882-3153  17-Nov-1992 0853
  3. Newsgroups: vmsnet.internals
  4. Subject: RE: Locking down a structure in C
  5. Message-ID: <9211170648.AA18702@vbormc.vbo.dec.com>
  6. Date: Tue, 17 Nov 92 07:48:20 MET
  7. Organization: Macro32<==>Vmsnet.Internals Gateway
  8. X-Gateway-Source-Info: Mailing List
  9. Lines: 44
  10.  
  11. >
  12. >   Here's another Open VMS Alpha AXP internals C question...
  13. >
  14. >   I'm converting some MACRO to C, and am changing  $DEFINI type
  15. > blocks of code to  structures...and some of these need locking down, eg.
  16. >
  17. <Deleted>
  18. > range:  .long   zzzdat
  19. >         .long   zzzdat + zzz$k_len
  20. >
  21. >         $lkwset_s       inadr = range
  22. >
  23. >
  24. >   Now, I'm trying to use a structure...
  25. >
  26. >         static struct
  27. >                 {
  28. >                 int l_zeep
  29. >                 int l_zap
  30. >                 int l_zip
  31. >                 } zzz ;
  32. >
  33. >   What would be the "best" way to "calculate" the address of the ends of
  34. >   structures to place in a range array for calling sys$lkwset?
  35. >
  36.  
  37. void *range[2] = {&zzz,&zzz+1};
  38.  
  39. /* The +1 in C address arithmetic is really +1*(sizeof object pointing to) */
  40.  
  41. This compiles and gives the correct answer under DEC C.
  42.  
  43. > Lee K. Gleason N5ZMR
  44. > Control-G Consultants
  45. > gleason@mwk.uucp
  46. >
  47.  
  48.         Yaacov
  49. -------------------------------------------------
  50. Yaacov Fenster                  +(972)-3-9307239
  51. y.fenster@ieee.org
  52. fenster@taveng.enet.dec.com     DTN 882-3153
  53. All the opinions voiced are mine alone and do not reflect anyone else's
  54. opinion. (Including Dec).
  55.