11-11-2011, 11:10 AM
I have a structure containing an unsigned int member; if I use any of the relational operators (>=, = u16_rev1_min) /* this violates rule 10.1 */
{
// do something...
}
uint16_t u16_rev1_min, u16_tmp;
u16_tmp = st_hardware_revs.u16_hw_rev1;
if (u16_tmp >= u16_rev1_min) /* this does not violates rule 10.1 */
{
// do something...
}
[/code]
My initial thought was due to the underlying 'int' type of the relational operator, however if this is the case then why does the second piece of code pass? Am I missing some implicit conversion applied to the strucuture reference?
Regards
{
// do something...
}
uint16_t u16_rev1_min, u16_tmp;
u16_tmp = st_hardware_revs.u16_hw_rev1;
if (u16_tmp >= u16_rev1_min) /* this does not violates rule 10.1 */
{
// do something...
}
[/code]
My initial thought was due to the underlying 'int' type of the relational operator, however if this is the case then why does the second piece of code pass? Am I missing some implicit conversion applied to the strucuture reference?
Regards
<t></t>