PJS@GROUCH.JPL.NASA.GOV (Peter Scott) (05/22/88)
The documentation for LIB$INIT_TIMER states that it takes different actions base on whether the argument handle-adr is absent, zero, or non-zero. How do you get the "absent" effect when calling from C? I have invariably found that I have to specify a 0 explicitly as a parameter when calling system routines where if I were using FORTRAN I would leave the argument blank. Peter Scott (pjs%grouch@jpl-mil.jpl.nasa.gov)
LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) (05/24/88)
The documentation for LIB$INIT_TIMER states that it takes different actions base on whether the argument handle-adr is absent, zero, or non-zero. How do you get the "absent" effect when calling from C? I have invariably found that I have to specify a 0 explicitly as a parameter when calling system routines where if I were using FORTRAN I would leave the argument blank. LIB$INIT_TIMER takes one argument, handle-adr; it is passed by reference. An optional argument may be omitted by passing 0 by value; or, if it is a trailing argument, by omitting it entirely. (The latter method won't work for system services, but will work for RTL calls.) So: char *cb = 0; /* Control block address */ LIB$INIT_TIMER(&cb); /* Allocate control block, set cb */ LIB$INIT_TIMER(&cb); /* Re-use allocated control block */ LIB$INIT_TIMER(0); /* Use static control block */ LIB$INIT_TIMER(); /* The same thing */ -- Jerry
LLACROIX@carleton.EDU (Les LaCroix) (05/26/88)
In a recent article, Peter Scott (pjs%grouch@jpl-mil.jpl.nasa.gov) writes: > The documentation for LIB$INIT_TIMER states that it takes different actions > base on whether the argument handle-adr is absent, zero, or non-zero. > > How do you get the "absent" effect when calling from C? I have invariably > found that I have to specify a 0 explicitly as a parameter when calling > system routines where if I were using FORTRAN I would leave the argument > blank. Note that the parameter for LIB$INIT_TIMER is passed by reference. In Fortran, an absent parameter is equivalent to %VAL(0). In C: Absent: lib$init_timer( 0 ); /* 0 by value */ Zero: lib$init_timer( &0 ); /* 0 by reference */ Non-zero: lib$init_timer( &x ); /* variable x by reference */ Les LaCroix SPSS Inc., 402 Washington, Northfield MN USA 55057-2027 tel 507/663-1205 lacroix%spssnf@carleton.edu (CSnet) lacroix%spssnf.carleton.edu@relay.cs.net (BITNET)
GG.SPY%ISUMVS%CUNYVM.CUNY.EDU%KL.SRI.COM%lbl%sfsu1.hepnet@LBL.GOV (05/29/88)
Received: from KL.SRI.COM by LBL.Gov with INTERNET ; Sat, 28 May 88 21:49:48 PDT Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Thu 26 May 88 07:02:12-PDT Received: from ISUMVS.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 3360; Thu, 26 May 88 09:58:02 EDT Date: Thu, 26 May 88 08:34:35 CDT To: <INFO-VAX@KL.SRI.COM> From: "John Hascall" <GG.SPY%ISUMVS.BITNET@CUNYVM.CUNY.EDU> Subject: Re: LIB$INIT_TIMER > Date: Sat, 21 May 88 16:15:53 PST > Sender: INFO-VAX Discussion <INFO-VAX@UBVM> > From: Peter Scott <PJS@grouch.JPL.NASA.GOV> > Subject: LIB$INIT_TIMER > To: John Hascall <GA.JPH@ISUMVS> > > The documentation for LIB$INIT_TIMER states that it takes different actions > base on whether the argument handle-adr is absent, zero, or non-zero. > > How do you get the "absent" effect when calling from C? I have invariably > found that I have to specify a 0 explicitly as a parameter when calling > system routines where if I were using FORTRAN I would leave the argument > blank. > > Peter Scott (pjs%grouch@jpl-mil.jpl.nasa.gov) When a VMS routine's parameter is passed by reference (pass the address of the parameter) or by descriptor (pass the address of a block describing the parameter) then to "omit the parameter" means to pass the value 0 (zero). [FORTRAN does this for you when you leave a parameter blank]. John Hascall ISU Computation Center Ames, Iowa
GG.SPY%ISUMVS%CUNYVM.CUNY.EDU%KL.SRI.COM%lbl%sfsu1.hepnet@LBL.GOV (05/29/88)
Received: from KL.SRI.COM by LBL.Gov with INTERNET ; Sat, 28 May 88 21:28:20 PDT Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Thu 26 May 88 06:58:08-PDT Received: from ISUMVS.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 3360; Thu, 26 May 88 09:58:02 EDT Date: Thu, 26 May 88 08:34:35 CDT To: <INFO-VAX@KL.SRI.COM> From: "John Hascall" <GG.SPY%ISUMVS.BITNET@CUNYVM.CUNY.EDU> Subject: Re: LIB$INIT_TIMER > Date: Sat, 21 May 88 16:15:53 PST > Sender: INFO-VAX Discussion <INFO-VAX@UBVM> > From: Peter Scott <PJS@grouch.JPL.NASA.GOV> > Subject: LIB$INIT_TIMER > To: John Hascall <GA.JPH@ISUMVS> > > The documentation for LIB$INIT_TIMER states that it takes different actions > base on whether the argument handle-adr is absent, zero, or non-zero. > > How do you get the "absent" effect when calling from C? I have invariably > found that I have to specify a 0 explicitly as a parameter when calling > system routines where if I were using FORTRAN I would leave the argument > blank. > > Peter Scott (pjs%grouch@jpl-mil.jpl.nasa.gov) When a VMS routine's parameter is passed by reference (pass the address of the parameter) or by descriptor (pass the address of a block describing the parameter) then to "omit the parameter" means to pass the value 0 (zero). [FORTRAN does this for you when you leave a parameter blank]. John Hascall ISU Computation Center Ames, Iowa