AnsweredAssumed Answered

Compile-time check of structure-size on CW S12 v. 5.0

Question asked by Sten Siren on Feb 10, 2010
Latest reply on Feb 11, 2010 by Sten Siren

My application has several external (I2C) EEPROMs and I have defined the data to store in them as an own stucture-typedef for each EEPROM. Because the sizes of the structures varies when I am developing the software, it is possible that a structure gets too big to fit in it's EEPROM. Is there a way to build a compile-time check for this (so that I get a compiler-error if a structure is too big)? The sizeof-operator does not work in preprocessor-directives so I can't use a "#if sizeof(i2c1_struct) > 0x7fff"-directive.

 

Any suggestions?

 

Sten

Outcomes