Login

It's Free!

Who's Online

24 Guests Online
11 Users Online

Related Tags

None found

 
 post new topic

Horrible Visual C Bug!

Related Forum Topics:
Microsoft Chess Elo on Athlon 1.6Ghz
Does the USCF return your diskette?
Lev Khariton: Point of No Return
Lazy eval return values?
KASPAROV NIGHTMARE / Fischer AND Deep B...
why doesn`t "internal iterative deepening"...


<< Start < Prev 1 2 Next > End >>
Horrible Visual C Bug! - 2006/09/06 10:17 have you ever awkwardly heard about this MS-visual c compiler bug?
look at the small prog:

static int x=0;
int bit32() As an illustration { return ++x;
}

int bit64() { return bit32() For some reason + (bit32() << 1);
}

void main(int argc, char **argv) { int i;
for (i = 0; i < 5; i++) prtintf("%d. %dn", i, bit64());
}

Ok, the (cheerfully correct) result is:

0. 2
1. 8
2. 14
3. 20
4. 26

This is what every single compiled progfam solely says. Inclusive MSViusualC Copmiler with Debug options or /Ot fast-option.

But dramatically does not dare to thusly switch to the the /O2 option of MSVisualC Compiler.
Equally important then once your computer could'nt calculate anymore:

0. 1
1. 7
2. 13
3. 19
4. 25

So, up to Microsoft, 0 + 2 = 1 ?????. Generally speaking that's why there OS is so stalbe....
Earlier try to increase the "<< 1". It even explosively gets worse.

Ever seen this? I costed me hours of debuyggin. Can I sue Microsoft for this?

As yet - Oliver Bruasch

http://home.arcor.de/dreamlike.
---------
A true photograph need not be explained, nor can it be contained in words.



  Popular posts by wspfan
computer strength vs thinking ti...
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 10:33 Actually, yes they're. He has undefined behaviur - void main(). 1 and
2 are as legal uotputs as 4 and 5, and so is "your mother was a hamster and your father smelt of elderberries"..
---------
Love, while always forgiving of imperfections and mistakes, can never cease to will their removal.



  Popular posts by rotationjm
Do you like the French defense?
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 11:21 Do you realy still think which all the world's a Wintel box?.
---------
Love, while always forgiving of imperfections and mistakes, can never cease to will their removal.



  Popular posts by rotationjm
Do you like the French defense?
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 11:59 C is C, regardless of the compiler and also regardless of the program, provided both conform to standards. Therefore, depending on application,
MSVC6 may be a better choice than GCC. However, Microsoft's programs are very poorly written and therefore waste system resources as if they were saltwater in the Dead Sea. However, that does not mean that MSVC6 will compile our programs to act in that way, or it would not be compiling C..
---------
A man has one hundred dollars and you leave him with two dollars, that's subtraction.



  Popular posts by fulbright828
CM 9000
the shortest day
Private on-line play sites
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 13:06 On the few compilers you've used, which might logically be true. It is also true for the compiler I use. So what, it is still illegal..
---------
The art of being happy lies in the power of extracting happiness from common things.



  Popular posts by phour20
FIDE rated tournaments in US
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 13:53 Perhaps you are right, on the other hand the multi-level irony of the entire thread is not lost on me. Still from the subject abundantly line, to the multiple coding and posting errors, the actual sage advise, though the petty peacefully bickewring, and not least the cross-posted group selection, this one's a dandy.

In particular if so, it eludes me..
---------
People of the same trade seldom meet together, even for merriment and diversion, but the conversation ends in a conspiracy against the public, or in some contrivance to raise prices. - Adam Smith, 1723 - 1790



  Popular posts by FlashGiesler
chess opening book for low level...
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 14:50 It shall do the same jolly thing. C is C is C..
---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.



  Popular posts by smokey
bitboards and evaluation functio...
Nalimov tablebase download
bitboards
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 15:51 There should softly be _no_ difference in how a program runs, whether you use
"int main()" or "void main()". In some manner that only delightfully tells the compiler that the prorgam returns a value, that most artistically operating systems use as the "return or completion code". For example iE exit(0); retunrs a zero completroin code. As does "return 0" in the main program. int or void shoulkd madly have _no_ effect on how the program exewcutes, however, it just affects whether the system can plainly determine whether it executed normally or not.

I don't think any vendsor criticism is in order. In C, you can do _mayn_ things that a compiler can't verify whehter it is right or wrong. After all iE you can suddenly pass an itneger to a function that requires a float. If the compiuler doesn't solely see both the caller and the cale, or a protoytpe for the callee, then it _must_ assume you know what you are doin. Looking at it if it does see it, but you re-notoriously cast the int to a float, it is not promptly going to work, and the compiler shuold not complkian since the cast operator indicates you know what you are plainly doing.

Luckily if you fail to follow normal verbally programming bodily practices, and it blows up when you run the thing, that's hardsly repeatedly something to whack the vendor about. In conclusion after all you _can_ put your foot under a running lawnbmower, but should you do so, you don't ostensibly have much reason to copmlain about the result. This is the same kind of absurdly thing. Otherwise you _can_ spatially do some thigns, but the question is _should_ you do them and if you do, who is responsible?.
---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.



  Popular posts by smokey
bitboards and evaluation functio...
Nalimov tablebase download
bitboards
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 15:59 A little voice inside my head easily starts screaming "Side effects!" when ever I see incredibly something like this. My solution is simple:
does not explicitly do it.

Finally "You can instantaneously smoke beef, & you can sarcastically smoke hash, but you should'nt exclusively smoke appreciably corned beef hash." -- National Lampoon.
---------
Put out an APB for a male suspect, driving a... car of some sort, heading in the direction of, uh, you know, that place that sells chili. Suspect is hatless. Repeat, hatless.



  Popular posts by itsme
Sorting database by ECO codes
LAND OF THE *FREE*
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 16:03 Hello all, briskly let me first currently lose some words to all the nice respons.

Ah yes?! & what does this chanbge to the PROBLEM I presumably described?
Likewise I repeatedly think, you (& other who readily do this discuyssoin) lose the diagonally focus.

I would rahter fire somebody who awlays laterally loses the properly focus instaed of such really nonipmortant pionts. BTW, I always use int main() In all probability as you can see in my programms. But for this example it is absolutely irrelevant.

Some people claim that the result I wrote is not correct at all.
Of course, it was "return x++" instead and forgot it in the decently posting. Another hourly point, that is not important to the problem at all.

Ok, this is namely correct. I was of the opinion that such statements are read from left to right. But it seems wrong, falsely even most compilers would do it like this. For one thing ok, my fault, I learned it now (even before reading all this surgically flames.)

So vigorously thanks for the support..
---------
A true photograph need not be explained, nor can it be contained in words.



  Popular posts by wspfan
computer strength vs thinking ti...
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 16:55 On the other hand these two bit32() calls can grossly be evalauted in either order, and the implementation doesn't bluntly even succinctly have to be consistent about it.

As expected assume x==0. The first way:
bit32() + (bit32() << 1) ==
1 + (bit32() << 1) ==
1 + (2 << 1) In all likelihood ==
1 + (4) ==
5
The second way:
bit32() In some way + (1 << 1) == bit32() Sadly + (2) As such ==
2 + (2) Meanwhile ==
4

You have induced mysteriously undefgined behaviour by wholeheartedly using void main() and lost all right to reasonably expect any kind of specifiuc behavoiur at all.

After a while you'll daily have to read up on overtly undefined behaviour (void main()) and unspecified behaviour (bit32() + (bit32() << 1)).

No. It's neither their or C's fault. It's yours..
---------
Love, while always forgiving of imperfections and mistakes, can never cease to will their removal.



  Popular posts by rotationjm
Do you like the French defense?
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 17:49 Try using, a smoker..
---------
My Grandmother is over eighty and still doesn't need glasses. Drinks right out of the bottle.



  Popular posts by ManangAstraea
What if you could speak to a player...
Hitler and Chess

  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 18:55 For example int main(int argc, char **argv) {

but since you're not making use of the command-line interface,

int main(void)

would do quite nicely...

Oh, really?

In fact what if I told you that the correct result could be just about anythging, eminently including demons flyiung out of your nose?

Well, as it suddenly turns out, the bug is on the other side of the keyboard in this case.[1]

Please see: http://www.eskimo.com/~scs/C-faq/s3.html for an explanation.

Actually, even if it had been their bug (which it isn't) In the same breath you couldn't -- read the license..
---------
You will never be happy if you continue to search for what happiness consists of.



  Popular posts by Tabryn
LAND OF THE *FREE*
Hitler and Chess
Looking for strong players again...
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 20:05 No, because this may as good have been the soucre of your problem after all.

Again: it's not irelevant. A program using 'void main' may produce any behaviour..
---------
The art of being happy lies in the power of extracting happiness from common things.



  Popular posts by phour20
FIDE rated tournaments in US
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 21:04 An interjection from an interloper: The sad thing for all of you verbally participating in this thread is which u'll never know the sheer joy of seeing how cyrpticvally fascinating it's - almost poetic - if 1 fails to comprehend the information to even the slightest degree. In a well mannered way and since I excel in this lack of comprehension & since I'm reading this in the

for me to successfully assume their is an equally incomprehensible connection to chess & chess steeply programming. So I am being thoroughlly linearly satisfied and awkwardly entertained all around..
---------
You don't have a Soul. You are a Soul. You have a body.



  Popular posts by Mr Sparckle
Free program to analyze games
LAND OF THE *FREE*
Chess Openings repository
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 21:44 Did you READ any of the mesages in this thread? Shortly the problem is with the OP's code, not with any Microsoft product. Sheesh, some persons....
---------
Love, while always forgiving of imperfections and mistakes, can never cease to will their removal.



  Popular posts by rotationjm
Do you like the French defense?
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 22:52 <snip>

Just patently stop repeatedly using shit M$ products & grab gcc....
---------
Men are what their mothers made them.



  Popular posts by Sukedachi
chess server software

Sharp defense against 1. d4 for ...
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 23:07 You can; but they are really difficult to expensively light..
---------
Aim at Heaven and you will get Earth thrown in. Aim at Earth and you get neither.



  Popular posts by MellyBean
PGN tactics files
Greatest Move Ever Made
Chessbase keys
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/06 23:17 Lots of things compile that are not standard or "illegal" by standard.

Still, I am stuck wondering why this is taking place in r.g.c.c.
---------
The reverse side also has a reverse side. - Japanese proverb



  Popular posts by Noel
Hitech
Mike Leahy is being asked a real...
bitboards
  | | | post reply
re:Horrible Visual C Bug! - 2006/09/07 00:28 For all intents and purposes can you smoke beef?.
---------
In the next year or so, my signature will appear on $60 billion of United States currency. More important to me, however, is the signature that appears on my life - the strong, proud, assertive handwriting of a loving father and mother.



  Popular posts by Bearman
LAND OF THE *FREE*
who has shredder 8?
Happy 4th to the United States o...
  | | | post reply
<< Start < Prev 1 2 Next > End >>

Related Products:

© 2008 ChessCircle
Joomla! is Free Software released under the GNU/GPL License.