O
Oliver Brausch
Hello,
have you ever heard about this MS-visual c compiler bug?
look at the small prog:
static int x=0;
int bit32() {
return ++x;
}
int bit64() {
return bit32() + (bit32() << 1);
}
void main(int argc, char **argv) {
int i;
for (i = 0; i < 5; i++) printf("%d. %d\n", i, bit64());
}
Ok, the (correct) result is:
0. 2
1. 8
2. 14
3. 20
4. 26
This is what every compiled progam says. Inclusive MSVisualC Compiler
with Debug options or /Ot fast-option.
But do not dare to switch to the the /O2 option of MSVisualC Compiler.
Then once your computer cannot calculate anymore:
0. 1
1. 7
2. 13
3. 19
4. 25
So, up to Microsoft, 0 + 2 = 1 ?????. That's why their OS is so stable....
Try to increase the "<< 1". It even gets worse.
Ever seen this? I costed me hours of debugging. Can I
sue Microsoft for this?
- Oliver Brausch
http://home.arcor.de/dreamlike
have you ever heard about this MS-visual c compiler bug?
look at the small prog:
static int x=0;
int bit32() {
return ++x;
}
int bit64() {
return bit32() + (bit32() << 1);
}
void main(int argc, char **argv) {
int i;
for (i = 0; i < 5; i++) printf("%d. %d\n", i, bit64());
}
Ok, the (correct) result is:
0. 2
1. 8
2. 14
3. 20
4. 26
This is what every compiled progam says. Inclusive MSVisualC Compiler
with Debug options or /Ot fast-option.
But do not dare to switch to the the /O2 option of MSVisualC Compiler.
Then once your computer cannot calculate anymore:
0. 1
1. 7
2. 13
3. 19
4. 25
So, up to Microsoft, 0 + 2 = 1 ?????. That's why their OS is so stable....
Try to increase the "<< 1". It even gets worse.
Ever seen this? I costed me hours of debugging. Can I
sue Microsoft for this?
- Oliver Brausch
http://home.arcor.de/dreamlike