Board index » cppbuilder » W8012

W8012


2008-01-31 12:40:25 AM
cppbuilder84
int main(int argc, char* argv[])
{
int a= 1;
int const a2= 2;
unsigned int b= 3;
unsigned int const b2= 4;
bool d= a < b;
bool e= a < b2;
bool f= a2 < b;
bool g= a2 < b2;
return 0;
}
I'm only seeing a warning for the first comparison so that means a
constant parameter causes the warning to not be given. I'll make a QC
report if its not already done.
There is another bug I've seen:
int A(int size){
if (size < (unsigned int)0)
return 1;
return 0;
}
If I pass -10 then the function should return 0. It appears that the
arithmetic conversion rule "--Otherwise, if either operand is unsigned,
the other shall be converted to unsigned." isn't being applied. It
probably isn't applied with other operators either.
Fraser.
 
 

Re:W8012

"Fraser Ross" < XXXX@XXXXX.COM >wrote in message
Quote
I'm only seeing a warning for the first comparison so that means a
constant parameter causes the warning to not be given.
What compiler and version are you using? In RAD2007 w/December 2007 Update
(aka Update 4) I get two W8012 warnings. In BCB6 I get one warning.
Quote
If I pass -10 then the function should return 0.
Testing this in RAD2007 Update 4 I get a result of "0". In BCB6 I get a
result of "1".
Clayton
 

Re:W8012

"Clayton Arends"
Quote
>I'm only seeing a warning for the first comparison so that means a
>constant parameter causes the warning to not be given.

What compiler and version are you using? In RAD2007 w/December 2007
Update
(aka Update 4) I get two W8012 warnings. In BCB6 I get one warning.
Turbo Explorer which is based on BCB2006. It gives 1 warning on the
first comparison. BCB6 gives a warning for the same comparison but
makes the location the functions opening brace. Which two comparisons
do you get the warning for?
Quote
>If I pass -10 then the function should return 0.

Testing this in RAD2007 Update 4 I get a result of "0". In BCB6 I get
a
result of "1".
Turbo Explorer gives 1.
Fraser.
 

{smallsort}

Re:W8012

"Fraser Ross" < XXXX@XXXXX.COM >wrote in message
Quote
Which two comparisons do you get the warning for?
The first and second comparisons.
Quote
>>If I pass -10 then the function should return 0.
>
>Testing this in RAD2007 Update 4 I get a result of "0". In BCB6 I get
>a result of "1".

Turbo Explorer gives 1.
Looks like they fixed that particular compliance bug in CB2007.
Clayton