Re: [Plib-users] problem with fnt and release mode
Brought to you by:
sjbaker
From: Scott S. <sjs...@um...> - 2000-12-21 01:24:56
|
Well, it only causes problems across functions, i.e.: int* g_pTheInt; // global variable. void foo() { *g_pTheInt = *g_pTheInt + 1; } and later... int* a; *a = 10; g_pTheInt = a; foo(); printf("%d", *a); // a should now be 11, but this may not be the case You can turn set the VC++ compiler optimization to "assume aliasing across function calls", which will fix the problem (effectively reloading the registers from memory, I assume). ------------------ Scott Shumaker sjs...@um... ----- Original Message ----- From: "Steve Baker" <sjb...@ai...> To: <pli...@li...> Sent: Wednesday, December 20, 2000 9:02 PM Subject: Re: [Plib-users] problem with fnt and release mode > Paul Bleisch wrote: > > > > More than likely it is either "global optimizations" or "assume > > no aliasing". These two cause the most problems. > > Yikes! > > Does "assume no aliasing" mean "assume no pointer aliasing" ?? > > If so, then you'll want to turn off that sucker - bury it *DEEP*! > > int x = 6 ; > int y ; > > int *a ; > int *b ; > > a = & x ; > b = & x ; > > ...then later on... > > *a = 1234 ; > *b = 0 ; > y = *a ; > printf ( "%d\n", y ) ; > > ...will probably print 1234 with a compiler that assumes there > is no pointer aliasing. > > It's hard to imagine any piece of software of any complexity > surviving that kind of punishment. > > -- > Steve Baker HomeEmail: <sjb...@ai...> > WorkEmail: <sj...@li...> > HomePage : http://web2.airmail.net/sjbaker1 > Projects : http://plib.sourceforge.net > http://tuxaqfh.sourceforge.net > http://tuxkart.sourceforge.net > http://prettypoly.sourceforge.net > > > > _______________________________________________ > plib-users mailing list > pli...@li... > http://lists.sourceforge.net/mailman/listinfo/plib-users |