模板元编程=解释 [英] Template metaprogramming = interpretation
问题描述
人们是否同意在很大程度上使用模板的声明
元编程技术将C ++编译器转换为C ++解释器(但
仅用于元编程部分的代码)?这不是一个完美的
类比,但它似乎是一个合理的陈述......
" ; Dave和QUOT;其中p是*********** @ yahoo.com>写了...人们会同意这样的说法:在很大程度上,使用
模板元编程技术将C ++编译器变成C ++解释器
(但仅用于元编程部分代码)?这不是一个完美的类比,但它似乎是一个合理的陈述......
每个编译器都是一个解释器,如果它可以处理的东西喜欢
int a = 1 + 2 + 3 + 4;
通过创建初始化为10的''a'的定义来代替
a使用
即时操作数执行三次添加的特殊代码。
Victor
" Dave"其中p是*********** @ yahoo.com>在消息新闻中写道:vu ************ @ news.supernews.com ...人们是否同意在很大程度上使用模板的声明<元编程技术将C ++编译器转换为C ++解释器(但仅仅是代码的元编程部分)?这不是一个完美的类比,但它似乎是一个合理的陈述......
我不同意这个陈述。它更像是一个超级编译器,因为它可以在编译时预编译代码,而不是在运行时翻译语言
。
" Victor Bazarov" <五******** @ comAcast.net>在消息新闻中写道:u8%Fb.119086
Would people agree with the statement that to a large degree, using template
metaprogramming techniques turns a C++ compiler into a C++ interpreter (but
just for the metaprogrammed portions of the code)? It''s not a perfect
analogy, but it seems to be a reasonable statement...
"Dave" <be***********@yahoo.com> wrote...Would people agree with the statement that to a large degree, using template metaprogramming techniques turns a C++ compiler into a C++ interpreter (but just for the metaprogrammed portions of the code)? It''s not a perfect
analogy, but it seems to be a reasonable statement...
Every compiler is an interpreter if it can handle things like
int a = 1 + 2 + 3 + 4;
by creating a definition of ''a'' initialised to 10 instead of
a special piece of code that performs three additions with the
immediate operands.
Victor
"Dave" <be***********@yahoo.com> wrote in message news:vu************@news.supernews.com...Would people agree with the statement that to a large degree, using template
metaprogramming techniques turns a C++ compiler into a C++ interpreter (but
just for the metaprogrammed portions of the code)? It''s not a perfect
analogy, but it seems to be a reasonable statement...
I wouldn''t agree with the statement. It''s more of a supercompiler as it
can precompute code at compile time as opposed to translating language
at run time.
"Victor Bazarov" <v.********@comAcast.net> wrote in message news:u8%Fb.119086
这篇关于模板元编程=解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!