Follwoing sample produces what appears to be wrong result, compared to MSVC.
//---------------------------------------------------------//
#include <stdio.h>
void main( char argc, char *argv[] )
{
unsigned int number = 0x80000002;
switch( number )
{
case 0 :
printf( "Error 0: %i", number );
break;
case 1 :
printf( "Error 1: %i", number );
break;
case 2 :
printf( "Error 2: %i", number );
break;
case 3 :
printf( "Error 3: %i", number );
break;
default :
printf( "Good: %i", number );
}
}
//---------------------------------------------------------//
Ron
[P.S. Pelle, I'm still not able to contact your private email. Could you please advise how I could contact you?]
The following variation (tested with latest 4.0) even causes a GPF:
//----------------------------------------------------//
#include <stdio.h>
void test( unsigned int number );
void main( char argc, char *argv[] )
{
long number;
number = 0x80000002;
test( number );
number = 0xF0000002;
test( number );
}
void test( unsigned int number )
{
switch( number )
{
case 0 :
printf( "Error 0: %i", number );
break;
case 1 :
printf( "Error 1: %i", number );
break;
case 2 :
printf( "Error 2: %i", number );
break;
case 3 :
printf( "Error 3: %i", number );
break;
default :
printf( "Good: %i", number );
}
}
//----------------------------------------------------//
Ron
FWIW, declaring number as:
unsigned int number;
makes no difference, and the source compiles without any warning, when using level 1 warning.
[Attached the actual source file.]
Ron
Ron,
This is the same problem as posted here (http://smorgasbordet.com/phpBB2/viewtopic.php?t=915). Are you the same person? FWIW, I replied there.
Hi Greg,
"This is the same problem as posted here. Are you the same person? FWIW, I replied there."
Sorry, I don't understand, "here" and "there". I posted 3 messages , all about the same topic, and all right here, in this thread.
Ron
Quote from: "Greg"Ron,
This is the same problem as posted here (http://smorgasbordet.com/phpBB2/viewtopic.php?t=915). Are you the same person? FWIW, I replied there.
The word "here", above, is a link to the URL
http://smorgasbordet.com/phpBB2/viewtopic.php?t=915
where Guerra000 (Vic) posted the same question.
Robert Wishlaw
Robert, Greg,
[Sorry, I somehow missed the link.]
No I'm not the same person, but Vic is a customer of mine, and I was not made aware that he already posted the issue. My apologies for the redundancy.
Ron
Quote from: "Greg"Ron,
This is the same problem as posted here (http://smorgasbordet.com/phpBB2/viewtopic.php?t=915). Are you the same person? FWIW, I replied there.
I'm sorry. I posted the same bug in other forum. I hadn't seen this (bug reports) forum.
Atte.
Vic
Quote from: "Greg"Ron,
This is the same problem as posted here (http://smorgasbordet.com/phpBB2/viewtopic.php?t=915). Are you the same person? FWIW, I replied there.
I'm sorry. I posted the same bug in other forum. I hadn't seen this (bug reports) forum.
Atte.
Vic