Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

variable arguments function call question

This topic is 2496 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do i end up performing the following?




void Function2(char* string,...)
{
// Finally combine strings
wchar_t szBuffer[256] = { 0 };

va_list vaList;
va_start(vaList, pszText);
vswprintf(szBuffer, pszText, vaList);
va_end(vaList);
}


void Function1(char* string,...)
{

Function2(string, ... );


}


Is this possible or does anyone have any recommendations on how to do it?

Share this post


Link to post
Share on other sites
Advertisement

How do i end up performing the following?




void Function2(char* string,...)
{
// Finally combine strings
wchar_t szBuffer[256] = { 0 };

va_list vaList;
va_start(vaList, pszText);
vswprintf(szBuffer, pszText, vaList);
va_end(vaList);
}


void Function1(char* string,...)
{

Function2(string, ... );


}


Is this possible or does anyone have any recommendations on how to do it?


I would advise you follow TheUnBeliever's advise.

But, there is another way to do it, but it's not good in a For Beginner's topic. Most platform assembly code allows you to call another function while using the same arguments passed to it. For example, in MIPS processors, arguments are stored in register a0-a3, and then onto the stack after that. So, you could just do this:


[color=#000088]asm void[color=#000000] [color=#660066]Function1[color=#666600]([color=#000088]char[color=#666600]*[color=#000000] [color=#000088]string[color=#666600],...)
[color=#666600]{
jr Function2
nop

[color=#666600]}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!