Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!microsoft!markro From: markro@microsoft.UUCP (Mark ROBERTS) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: No Aliasing Compile Option Keywords: Microsoft 6.0 C update woes Message-ID: <55054@microsoft.UUCP> Date: 5 Jun 90 17:02:22 GMT References: <1990May23.234917.21858@uunet!unhd> <250@demott.COM> <12215@bunker.UUCP> Reply-To: markro@microsoft.UUCP (Mark ROBERTS) Organization: Microsoft Corp., Redmond WA Lines: 44 In article <12215@bunker.UUCP> shap@clunker.UUCP (Joseph D. Shapiro) writes: >In file a.c > > static int foo; > > main() > { bar(foo); } > > baz() > { foo++; } > >in file b.c > > foo(int x) > { ... establish a value for x here ... > baz(); > ... reference x here ... > } > >is this not aliasing as well? >will not -Oa cause trouble in b.c? Well, sort of. I think you have a couple of problems with your example - the function foo should be named bar and since ints are passed by value there can be no aliasing. But, try this: static int foo; main() { bar(&foo); } baz() { foo++; } int bar(int *x) { *x=3; baz(); return *x; } Now you've got aliasing and -Oa will fail, even in same file. But is it the same example? Do people really write code like this? I would certainly not encourage this, but no doubt its done. In which case, you can't use -Oa; however, -Ow would work.