这是一个不变的表达吗? [英] Is that a constant expression?
问题描述
假设我们有某个地方
typedef enum foo {A,B,C} foo;
C + 1是一个常量表达式吗?>
[
我想写smth。喜欢
char * strs [C + 1] = {" Astr"," Bstr"," Cstr"};
]
有人可以帮忙吗?
问候,
亚历克斯。
-
comp。 lang.c.moderated - 审核地址: cl**@plethora.net
Assume we have somewhere
typedef enum foo { A,B,C } foo;
Is C+1 a constant expression?
[
I want to write smth. like
char* strs[C+1]={"Astr","Bstr","Cstr"};
]
Could anyone help?
Regards,
Alex.
--
comp.lang.c.moderated - moderation address: cl**@plethora.net
推荐答案
" Alexander Malkis" <人****** @ LOESCHEDIESline.cs.uni-sb.de>在消息中写道
news:cl **************** @ plethora.net ...
"Alexander Malkis" <al******@LOESCHEDIESline.cs.uni-sb.de> wrote in message
news:cl****************@plethora.net...
假设我们有某个地方
typedef enum foo {A,B,C} foo;
C + 1是一个常量表达式吗?
是的。
[
我想写一下。喜欢
char * strs [C + 1] = {" Astr"," Bstr"," Cstr"};
任何人都可以帮忙吗?
Assume we have somewhere
typedef enum foo { A,B,C } foo;
Is C+1 a constant expression?
Yes.
[
I want to write smth. like
char* strs[C+1]={"Astr","Bstr","Cstr"};
]
Could anyone help?
看起来对我好。你遇到麻烦了吗?
-Mike
It looks OK to me. Are you having trouble with it?
-Mike
没有。尚未。
谢谢。
亚历克斯。
Mike Wahler写道:
No. Not yet.
Thank you.
Alex.
Mike Wahler wrote:
新闻:cl **************** @ plethora.net ...
"Alexander Malkis" <al******@LOESCHEDIESline.cs.uni-sb.de> wrote in message
news:cl****************@plethora.net...
假设我们有某个地方
typedef enum foo {A,B,C} foo;
C + 1是一个常量表达式吗?
Assume we have somewhere
typedef enum foo { A,B,C } foo;
Is C+1 a constant expression?
是的。
Yes.
[
我想写smth。喜欢
char * strs [C + 1] = {" Astr"," Bstr"," Cstr"};
任何人都可以帮忙吗?
[
I want to write smth. like
char* strs[C+1]={"Astr","Bstr","Cstr"};
]
Could anyone help?
对我来说看起来不错。你遇到了麻烦吗?
-Mike
It looks OK to me. Are you having trouble with it?
-Mike
Alexander Malkis <人****** @ LOESCHEDIESline.cs.uni-sb.de> skrev i
meddelandet新闻:cl **************** @ plethora.net ...
"Alexander Malkis" <al******@LOESCHEDIESline.cs.uni-sb.de> skrev i
meddelandet news:cl****************@plethora.net...
假设我们有某个地方
typedef enum foo {A,B,C} foo;
C + 1是一个常量表达式吗?
Assume we have somewhere
typedef enum foo { A,B,C } foo;
Is C+1 a constant expression?
这取决于。
如果使用内置运算符+,则为。如果你已经写了一个自己的
算子+(foo,int),那就不行了。
-
Dag Henriksson
That depends.
If the built-in operator+ is used, it is. If you have written an own
operator+(foo, int), it isn''t.
--
Dag Henriksson
这篇关于这是一个不变的表达吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!