Topic: Help: May I #define EMPTY "//"?


Author: wen@MCS.COM (Wen Xu)
Date: 3 Mar 1995 09:11:16 -0600
Raw View
Hi, netters

    I have a function:
         void my_valist(char* format, ...);

     and I want to call this function using a macro, like:
         VALIST_MACRO(f, v);  // v is a va_list

    VALIST_MACRO is a macro, ( when I define MY_VALIST, VALIST_MACRO
      is a function, otherwise, it is a empty statement, ot a comment)
        #ifdef MY_VALIST
                #define VALIST_MACRO        my_valist
        #else
                #define VALIST_MACRO(...)   EEMMPPTTYY //question
        #endif

    the question is:
        HOW TO DEFINE THE MACRO?

    I tried :

    1.  re-definition:
        #define VALIST_MACRO(X)    my_valist(X)
        #define VALIST_MACRO(X,Y)  my_valist(X,Y)
    2.  error before '(':
        #define VALIST_MACRO    "//"


   through I can do like this:

   my_valist(...)
   {
   #ifdef MY_VALIST
 ....;
   #endif
   }

   then, I have to call the function, even it is empty. it waste time.
   so, I wish I can decide whether I will call the function when I compile it.