Enum usage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enum usage

596 Views
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??

Labels (1)
0 Kudos
1 Reply

495 Views
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 Kudos