ITK Function Reference

(V10000.1.0.60_20160308.00)
ug_va_copy.h
Go to the documentation of this file.
1 /*HEAD UG_VA_COPY HHH INCLUDE */
2 /*==============================================================================
3 
4  Copyright 2005 UGS Corp.
5  Unpublished - All rights reserved
6 
7 ================================================================================
8 File description:
9 
10  Default definition of va_copy.
11 
12  The va_copy macro is needed in situations where the va_list argument is
13  used more than once, since on some platforms the implementation of
14  va_list/va_arg invalidates any reuse of the va_list type. Use va_copy
15  to make a copy of the va_list argument prior to any call to va_arg. E.g.
16 
17  static int dump( const char *format, ... )
18  {
19  va_list ap;
20  va_start(ap, format);
21 
22  va_list qp;
23  va_copy(qp,ap);
24  vfprintf(ERROR_ask_system_log_stream(), format, qp);
25  va_end(qp);
26 
27  int len = vprintf(format, ap);
28  va_end(ap);
29 
30  return len;
31  }
32 
33  If needed, this header *must* be preceded by inclusion of stdarg.h, since
34  that header may supply a platform specific version of va_copy.
35 
36 ================================================================================
37  Date Name Description of Change
38 09-May-2005 Jack Marr Use common definition of va_copy
39 $HISTORY$
40 ==============================================================================*/
41 
42 #ifndef UG_VA_COPY_H_INCLUDED
43 #define UG_VA_COPY_H_INCLUDED
44 
45 #ifndef va_start
46 #error "Inclusion of ug_va_copy.h must be preceded by inclusion of stdarg.h"
47 #endif
48 
49 #ifndef va_copy
50 #define va_copy(dst, src) ((dst) = (src))
51 #endif
52 
53 #endif
54