[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers

Title:** Hackers **
Moderator:XDELTA::HOFFMAN
Created:Mon Feb 01 1988
Last Modified:Tue May 27 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1838
Total number of notes:13578

1833.0. "ARG_COUNT macro" by GALVIA::FOX_F () Fri Mar 28 1997 14:13

    
    Has anyone come across a version of the following macro that would
    work on the alpha - a vax application with C code that we are porting 
    uses this macro all over the place. 
    
    Is there a "va_count" macro for Alpha ... 
    
    thanks for any help, 
    John. 
    
    
    
/*        V A R I A B L E   A R G U M E N T   L I S T   M A C R O S           */

/* NOTE: THE FOLLOWING MACROS ALL ASSUME THAT AN ARG LIST IS COMPOSED SOLELY
 * OF LONGWORD ARG ADDRESSES. 
 */


/* ARG_COUNT is an alternative to the va_count macro; given the address of the
 * first arg in an arg list, it yields the arg count.
 */	
#define ARG_COUNT(alist) (*(((long *) &(alist))-1))
    
T.RTitleUserPersonal
Name
DateLines
1833.1va_countCSC64::BLAYLOCKIf at first you doubt,doubt again.Fri Mar 28 1997 22:0611
It is in <varargs.h> for DEC C on both VAX and Alpha OpenVMS platforms
as well as for the VAXC Compiler.

So just '#include <varargs.h>' in your code (and get rid of your
definition).


btw, the .0 definition is incorrect because the argument count is
just a byte, not a longword.  The other 24bits are/were 'reserved
to Digital software'.
1833.2TURRIS::DECC For C Questions...XDELTA::HOFFMANSteve, OpenVMS EngineeringMon Mar 31 1997 16:327
:    Is there a "va_count" macro for Alpha ... 

   TURRIS::DECC is a better spot for standard C questions -- the variable
   argument list information is definitely documented in the DEC C manuals.
   
   (Standard variable-length argument list processing uses the stdarg.h
   module, not <varargs.h>.  The "va_count" extension is not portable.)