• Advertisement

Archived

This topic is now archived and is closed to further replies.

What does ... mean?

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

I'm reading through Programming RPG's with DirectX and I'm puzzled by a function call. void AppError(BOOL Fatal, char *Text, ...); I've seen this '...' in some other stuff as well, but have never seen an explanation for what it means. It has to be some sort of variable I'm presuming, but I have no idea what it could be. Can anybody enlighten me? Also one more thing. I know what the difference is between using the old #define preprocessor and the newer const command. But why would you use both as in the example below? Shouldn't you always use const?
  
#define WNDWIDTH	 400;
#define WNDHEIGHT	 400;
#define WNDTYPE	 WS_OVERLAPPEDWINDOW;

const char g_szClass[]	   =  "FrameClass";
const char g_szCaption[]   =  "FrameCaption";
    
The example was taken from the RPG book and I'm just wondering why the author did that. Thanks guys! quiggy.

Share this post


Link to post
Share on other sites
Advertisement
Here''s the answer to the second question

say you had this

#define WNDWIDTH 400;


when the compiler encountered WNDHEIGHT it would replace it with 400

if you have this

const char g_szClass[] = "FrameClass";

Then when your compiler see''s g_szClass it tells the computer where in memeory the string "FrameClass" would be located. This means that "FrameClass" would have to be stored once in the exe file and then all the code that wants it would just have a pointer to it. With the define above however the 400 gets stored everywhere it is used.

Hopefully that made sense

Share this post


Link to post
Share on other sites
Thanks for the link ze_jackal. Exactly what I needed...

And thanks to Mondar for the DEFINE refresher course. :-) It''s nice to see what exactly is going on behind the scene.

Quiggy.

Share this post


Link to post
Share on other sites
It''s called an ELLIPSIS.

It specifies like said a variable number of arguments to the function.

You use the va_xxx functions to work with the ellipsis to get the data off the stack frame.

Functions like printf use this so you can supply a variable number of arguments to the function.

Share this post


Link to post
Share on other sites

  • Advertisement