Passing Ellipses ('...') thru to another function

Started by
3 comments, last by Zahlman 15 years, 9 months ago
I'm looking for a way to pass '...' thru to another function, like:

void A(...)
{

}

void B(...)
{
 A(...)
}

Because vsscanf is not supported on non-Unix systems (Windows, VC++). How can I get around this? I found an intersting link which probably fixes this problem by copying stacks: http://www.codeproject.com/KB/tips/va_pass.aspx but I don't know nothing about templates. Is there a simple C(++) or assembly implementation for it (because that would be easier to understand for me)? I normally use sscanf to read doubles, strings and integers so there's no fixed size of the arguments. Thanks
Be creative, don't copy...Greets from Holland!
Advertisement
Since you are using C++, do yourself a favor and stay far away from variable argument lists. I think the preferred method is to use streams like stringstream to get the same functionality.

As summed up by somebody's sig (I think it's in Zahlman's): When you invoke the dreaded ellipsis construct, you leave the happy world of type safety.
Mike Popoloski | Journal | SlimDX
There are a bunch of WIn32 implementations around like this.
Thanks Simian Man. The one you mentioned (by mgix) worked in my test application, however whenever I implement it in my game it will give a 0x000005 error.

I made one vsscanfwin32 myself based on the idea of Anuj Seth and Rainer Bauer but without the CString class. That one worked in my game.
Be creative, don't copy...Greets from Holland!
Quote:Original post by Mike.Popoloski
Since you are using C++, do yourself a favor and stay far away from variable argument lists. I think the preferred method is to use streams like stringstream to get the same functionality.

As summed up by somebody's sig (I think it's in Zahlman's): When you invoke the dreaded ellipsis construct, you leave the happy world of type safety.


::cough::. :) Thanks, SiCrane.

OP: What are you trying to do? I mean really? What would you do if ellipses were not part of the language? Why do you think ellipses will make this easier?

And for that matter, why would you be using sscanf() to read things in C++?

This topic is closed to new replies.

Advertisement