关于宏的小测验 [英] A little quiz on macros
问题描述
如何用宏实现静态字典?
例如,五行
PL_FIND(MYDICT,HOUSE)
PL_FIND(MYDICT,AUTO)
PL_FIND(MYDICT,THIS_IS_NOT_IN_THE_DICTIONARY)
PL_FIND(MYDICT,jhgjhguytuyhkgjhg)
PL_FIND (MYDICT,3498fjkhdlkh34098jhf)
应该产生:
house_definition
auto_definition
symbol_not_found
symbol_not_found
symbol_not_found
Kiuhnm
How would you implement a static dictionary with macros?
For example, the five lines
PL_FIND(MYDICT, HOUSE)
PL_FIND(MYDICT, AUTO)
PL_FIND(MYDICT, THIS_IS_NOT_IN_THE_DICTIONARY)
PL_FIND(MYDICT, jhgjhguytuyhkgjhg)
PL_FIND(MYDICT, 3498fjkhdlkh34098jhf)
should produce:
house_definition
auto_definition
symbol_not_found
symbol_not_found
symbol_not_found
Kiuhnm
推荐答案
Kiuhnm<" kiuhnm03 [" @] yahoo.it>写道:
Kiuhnm <"kiuhnm03["@]yahoo.it> wrote:
你如何用宏实现一个静态字典?
How would you implement a static dictionary with macros?
我不会。学习愚蠢的预处理技巧是一个灾难性的b
灾难;你_will_在生产代码中使用它们,并且_will_
创造性地和令人头疼的错误。
下一个!
Richard
I wouldn''t. Learning stupid preprocessor tricks is a recipe for
disaster; you _will_ use them in production code, and that _will_ go
creatively and headache-inducingly wrong.
Next!
Richard
Richard Bos ha scritto:
Richard Bos ha scritto:
我不会。学习愚蠢的预处理技巧是灾难的一个秘诀;你_will_会在生产代码中使用它们,并且_will_会创造性地和令人头疼的错误。
I wouldn''t. Learning stupid preprocessor tricks is a recipe for
disaster; you _will_ use them in production code, and that _will_ go
creatively and headache-inducingly wrong.
C语言是一种技巧。 C ++语言是一个技巧。大会
语言是一招。杠杆是一个技巧。我们看到的是一招。然后
那又怎样?我们应该限制好奇心和创造力吗?我不这么认为。
一个小小的测验是一个小小的测验,而不是建立强大的工业应用程序的秘诀。无论如何,我很确定有一个标准的
描述了C预处理器。
Kiuhnm
The C language is a trick. The C++ language is a trick. The assembly
language is a trick. A lever is a trick. What we see is a trick. And
then what? Should we limit our curiosity and creativity? I don''t think so.
A little quiz is a little quiz, not a recipe for building strong
industrial applications. Anyway I was quite sure there was a standard
describing the C preprocessor.
Kiuhnm
在2006-05-10,Kiuhnm< kiuhnm03 ["]>写道:
On 2006-05-10, Kiuhnm <"kiuhnm03["@> wrote:
Richard Bos ha scritto:
Richard Bos ha scritto:
我不会。学习愚蠢的预处理技巧是灾难的一个秘诀;你_will_在生产代码中使用它们,并且_will_将创造性地和令人头疼的错误。
I wouldn''t. Learning stupid preprocessor tricks is a recipe for
disaster; you _will_ use them in production code, and that _will_ go
creatively and headache-inducingly wrong.
C语言是一个技巧。 C ++语言是一个技巧。汇编语言是一种伎俩。杠杆是一个技巧。我们看到的是一招。
The C language is a trick. The C++ language is a trick. The assembly
language is a trick. A lever is a trick. What we see is a trick.
当然可以。不同之处在于他们并不愚蠢。
Sure they are. The difference is they''re not stupid.
这篇关于关于宏的小测验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!