13-09-2011, 07:51 AM
I have compiled the following code. The compiler accepts the first loop (ending at X) but rejects the other two (ending at X+2 and at X*2)
extern tUI16 X, Y;
void Fn( void )
{
tUI16 i;
for( i = 0u; i < X; i++ ) /* accepted */
{
Y += i;
}
for( i = 0u; i < (X + 2u); i++ ) /* rejected */
{
Y += i;
}
for( i = 0u; i < (X * 2u); i++ ) /* rejected */
{
Y += i;
}
}
The compiler suppliers say the compiler will accept the second expression if it is "a simple test" and that X+2 and X*2 do not pass this test. I feel this is being too restrictive for rule 13.5. Please may I have an opinion on this.
Thanks,
John
extern tUI16 X, Y;
void Fn( void )
{
tUI16 i;
for( i = 0u; i < X; i++ ) /* accepted */
{
Y += i;
}
for( i = 0u; i < (X + 2u); i++ ) /* rejected */
{
Y += i;
}
for( i = 0u; i < (X * 2u); i++ ) /* rejected */
{
Y += i;
}
}
The compiler suppliers say the compiler will accept the second expression if it is "a simple test" and that X+2 and X*2 do not pass this test. I feel this is being too restrictive for rule 13.5. Please may I have an opinion on this.
Thanks,
John
<t></t>