This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using varargs.h with C++ <iostream>



>| The <varargs.h> header does some work to #undef# conflicts
>| from <stdarg.h>, but the reverse doesn't seem to be true.
>| Also, <iostream> eventually includes <stdarg.h> through
>| streambuf.h
>| 
>| This results in a situation where <varargs.h> will work
>| properly if it is included after <iostream> but not if it
>| is included before.  Is this intended?
>| 
>| (all of the above observations are made wrt the 8/24 snapshot)
>| 
>| 
>| - Josh
>| 
>| jstern@citilink.com

>I think that the answer is that <varargs.h> is not compatible
>with <iostream> anyway.
>
><varargs.h> is not ANSI, its an old set of macros that have
>been replaced by <stdarg.h>.  <varargs.h> is only there
>for backwards compatibility but should be avoided if possible.

Well yes, I know all of that.  But in fact I was porting 
someone elses crufty old code from SGI to Linux and they
did use <varargs.h> with <iostream> and I had to spend a bit
of time to figure out that it would work (without rewriting)
their program if <varargs.h> was included after <iostream>
but not before (which it originally was).  If this asymmetry
is a consequence of some other important constraint, then fine.  
But if it is just a missing #ifdef somewhere then it would be 
nice to change.  The <varargs.h> is distributed with egcs.


- Josh

jstern@citilink.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]