# ... as a param?

## Recommended Posts

from nehe tutorial number 13:
GLvoid glPrint(const char *fmt, ...)// Custom GL "Print" Routine


i get "warning C4793: 'glPrint' : function compiled as native : 1> varargs not supported under /clr" what does that mean, and what does the ... mean?

##### Share on other sites
It's a variable argument list, it's pretty weird when you first get into it.

http://www.cprogramming.com/tutorial/lesson17.html

##### Share on other sites
oh wow, that's a really kool feature. TY

##### Share on other sites
Quote:
 Original post by pavel989oh wow, that's a really kool feature. TY

It's a throwback to older days, and it has been the source of a *lot* of bugs.

Newer code should generally use chained stream operators.

When you do need to use it, you must be very careful to ensure that the parameters in your string match the additional parameters in the ... section. Failure to do so can cause your program to crash or worse.

##### Share on other sites
yeah i know, but i came to c++ from c#, and came to that from python/ruby. so im kind of used to being fairly consistent with that. But for small scale applications, i think it'd be fine. But I'd expect it to be discouraged.

##### Share on other sites
You know, that message suggests you are compiling with /clr which, if you are interested in doing C++ development (as opposed to C++/CLI for managed/unmanaged interop code) you probably do not want enabled. Did you intend to create a CLR project?

##### Share on other sites
after looking into that, no i think id rather not work with clr. ill try to figure out how to turn it off

##### Share on other sites
It is worth noting though that the '...' in C [and thus by extension, C++, but it started in C] isn't exactly what would be considered a good feature to use since C++ introduced much nicer mechanisms to handle what '...' was designed to deal with. If you're making language choices based on your intention to use the '...' style of parameter passing, then perhaps you should reconsider your use for it to see if there is a less error-prone and more friendly mechanism to accomplish what you want to do. There are other reasons to not want to use C++/CLI, but if you are making the choice to hold onto the '...' in old C code, it sends up a bit of a red flag.

##### Share on other sites
Quote:
 Original post by DrigovasC++ introduced much nicer mechanisms to handle what '...' was designed to deal with.

And this trend continues in C++0x with the introduction of std::initializer_list.

##### Share on other sites
i dont think i wanna work with CLI, and i was just noting that that's an interesting feature, but i don't think i will use it.

thanks for all the responses!

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627667
• Total Posts
2978539

• 10
• 10
• 10
• 12
• 22