Hey all,
I''ve got a function which takes a variable number of arguments (the ''...'' expression as its final parameter).
I loop through the va_list and add each item (they''re all meant to be pointers to strings) to a std::vector.
How do I know when I''ve reached the end of the list? Is it even possible to find out, without the introduction of a dummy ''eof'' argument?
Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
ry. .ibu cy. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
Variable argument lists
You need to figure out the number of arguments through some means other than the
va_list
. Using a required argument (like *printf
does) or terminating the list using a special value are possible ways.
Carp. OK, thanks.
I think I''ll prefix the ''...'' argument with a int telling how many there are in the variable argument list. I can give it a default value of 0, so if you''re not passing any strings you just leave it off.
Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
ry. .ibu cy. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
I think I''ll prefix the ''...'' argument with a int telling how many there are in the variable argument list. I can give it a default value of 0, so if you''re not passing any strings you just leave it off.
Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
ry. .ibu cy. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement