Since we've decided exit() doesn't matter, how slow are variable arguments?
Since we've decided exit() doesn't matter, how slow are variable arguments?
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
These "how slow is foo" questions are quite silly. It will depend on the compiler, the platform, what you're doing with them, etc.
If you're curious, why don't you do some benchmarking on it yourself? Personally, I don't see the point. Even if we take the simple case of printf, is the bottleneck of the function the act of parsing the format specifier, the overhead of doing I/O to a stream, or the fact that it has variable arguments. I'd expect not the latter. Implementation-wise, variable arguments are just parameters pushed onto the stack, like any other function. The speed the function executes will depend on the processing done, rather than the fact that it's a variable number.
Okay, I'll stop asking "How slow is foo?". Just wondering.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Sorry, calling it silly was perhaps a little harsh.
That's okay.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Dunno, but posting vague questions seems pretty quick
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.