Re: How to best cope with variadic input

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 March 2011 11:33, Maximilian Schneider wrote:
> On Tue, 2011-03-01 at 08:59 +0000, Jonathan Wakely wrote:
>> > 2.  Turn on C++ and overload safeprint with different combinations of
>> > arguments
>>
>> A better option would be to use a C++ variadic template.
[snip]
> I would have to agree with Jonathan here. In my experience with c++ (Qt)
> overloading has only caused me trouble.

I'm not sure we agree :)
I have no problem with using overloaded functions, but writing lots of
overloaded functions would be a headache.  A single variadic template
would do a better job than an entire set of overloaded functions, see
the printf template at
http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html

But I do agree that for this case, where the original code is in C,
simply using <stdarg.h> and vprintf is the most straightforward
solution.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux