Enum usage

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Enum usage

1,318件の閲覧回数
bengtandersson
Contributor III

I am writing a application in C for 5602B and I'm using enum:s in a way that I'm not absolutely  sure is OK.

 

enum

{

     variablesStartAddress = 0,

 

     channelMaskAddress = variablesStartAddress,

 

     dockingParamsAdress = channelMaskAddress + sizeof(tChannelMaskParam)

 

 

 

};

 

For C++ I have found proof that it is OK to use previous elements in the enumeration list to asign a value to an element but not for C. This compiles and builds without problems for me but that doesn't necessarily mean that it is supported. Is this OK in CW10.6??

ラベル(1)
0 件の賞賛
返信
1 返信

1,217件の閲覧回数
martin_kovar
NXP Employee
NXP Employee

Hi,

I tried this construction in CW10.6 and it seems it is OK. But only remember that two elements will have the same value.

Regards,

Martin

0 件の賞賛
返信