Click here to Skip to main content
15,888,271 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Do not take this question as a complex one.What I want to know is,Which mechanisms are being used by compiler developers to implement both general "template" and "variadic template" functionality.I've researched about this topic and found some optional mechanisms such as "C style preprocessing trick" and structured template fucntions.
And I have found following link also,
http://stackoverflow.com/questions/7683041/how-to-implement-variadic-template-with-pre-c0xvs2008[^]

Mainly I want to know is How can we implement variadic template like scenario in older C++ compiler(do not take this as reinventing the wheel).Please post replies,if you can provide some useful links or sources.
Thank you.
(Sorry for my bad english)
Posted
Comments
Richard MacCutchan 5-Feb-15 6:10am    
Which mechanisms are being used by compiler developers
Only the compiler developers could answer that question.

1 solution

Based on the initial "Do not take this question as a complex one.", I can only conclude the only valid answer is NULL, SEGV, or NaN.

Templates themselves are devilisly hard to get right. Variadic templates are ... harder.

Mainly I want to know is How can we implement variadic template like scenario in older C++ compiler
Not possible. You'd need a complete C++ parser to understand it, and by then you already have the whole AST to send to the backend. In MS-parlance, you'd have to implement a c1xxEXTRAPLUS.dll, and then simply hand it off to c2.dll. There is no way to (reasonably and reliably) convert C++ 11 code into C++ 98 code.
 
Share this answer
 
Comments
Buddhi Chaturanga 8-Feb-15 2:37am    
Thanks for the reply."There is no way to (reasonably and reliably) convert C++ 11 code into C++ 98 code." notice the point as you mentioned.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900