Jump to content
  • Advertisement
Sign in to follow this  
Winegums

variable length arguements

This topic is 3923 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

Hi, I'm using variable length arguements in an application I'm writing. for some reason it produces strange results. I thought it might be because i'm trying to pass D3DXVECTORs as the variable objects, and found this post: http://www.thescripts.com/forum/thread60215.html but I don't understand what the reply means. Should I be able to use D3DXVECTORs as vargs? or do I need to break them up into floats?

Share this post


Link to post
Share on other sites
Advertisement
Your unit tests should catch whether strange results appear because of this or something else.

To the best of my knowledge, you can use stdarg.h with any C-compatible type (under the usual type-conversion constraints). So, if D3DXVector is C-compatible (no constructors, for example) then it should work.

My knowledge of C, however, is quite limited. May I suggest moving to a more C++-friendly approach?

Share this post


Link to post
Share on other sites
You also may have more luck passing a pointer to a struct rather than the struct itself. However, in general varargs are bad juju.

Share this post


Link to post
Share on other sites
Quote:
Original post by Winegums
Hi, I'm using variable length arguements in an application I'm writing.


Why?

Quote:
for some reason it produces strange results.


This is rarely surprising.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!