🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: vmsnet.internals
Article #445

RE: Locking down a structure in C

#445
From: Yaacov Fenster 882-3153 17-Nov-1...
Date: Tue, 17 Nov 1992 06:48
44 lines
1620 bytes
>
>   Here's another Open VMS Alpha AXP internals C question...
>
>   I'm converting some MACRO to C, and am changing  $DEFINI type
> blocks of code to  structures...and some of these need locking down, eg.
>
<Deleted>
> range:  .long   zzzdat
>         .long   zzzdat + zzz$k_len
>
>         $lkwset_s       inadr = range
>
>
>   Now, I'm trying to use a structure...
>
>         static struct
>                 {
>                 int l_zeep
>                 int l_zap
>                 int l_zip
>                 } zzz ;
>
>   What would be the "best" way to "calculate" the address of the ends of
>   structures to place in a range array for calling sys$lkwset?
>

void *range[2] = {&zzz,&zzz+1};

/* The +1 in C address arithmetic is really +1*(sizeof object pointing to) */

This compiles and gives the correct answer under DEC C.

> Lee K. Gleason N5ZMR
> Control-G Consultants
> gleason@mwk.uucp
>

        Yaacov
-------------------------------------------------
Yaacov Fenster                  +(972)-3-9307239
y.fenster@ieee.org
fenster@taveng.enet.dec.com     DTN 882-3153
All the opinions voiced are mine alone and do not reflect anyone else's
opinion. (Including Dec).
Technical Details
Message-ID: <9211170648.AA18702@vbormc.vbo.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32
From: Yaacov Fenster @ISO 882-3153  17-Nov-1992 0853
Newsgroups: vmsnet.internals
Subject: RE: Locking down a structure in C
Message-ID: <9211170648.AA18702@vbormc.vbo.dec.com>
Date: Tue, 17 Nov 92 07:48:20 MET
Organization: Macro32<==>Vmsnet.Internals Gateway
X-Gateway-Source-Info: Mailing List
Lines: 44