Path: chuka.playstation.co.uk!news From: Chris Chadwick Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Re: Optimise Problem - trunced data Date: Sat, 02 Aug 1997 13:24:34 -0700 Organization: PlayStation Net Yaroze (SCEE) Lines: 44 Message-ID: <33E39782.6C3F@dial.pipex.com> References: <333d7fd9.23907964@news.playstation.co.uk> <33424023.72C4@interactive.sony.com> <33D5B732.3AC9@dial.pipex.com> <01bc9c44$3fe961e0$ca2c9ac2@martin.snsys.com> NNTP-Posting-Host: am080.du.pipex.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.02 (Win95; I; 16bit) Martin Day wrote: > > Chris Chadwick wrote in article > <33D5B732.3AC9@dial.pipex.com>... > > ... > > > > Is there no way around this problem? Does this mean we can't use > > optimization with any code that uses any of the libps global > > variables? If so this basically means none of the globals can be > > used because everyone is going to want their stuff to run as fast > > as possible by using optimization (I know I do!) > > > > What a bummer :( especially when everythings OK > > when using the -O0 switch... wee-urd! > > One possible way round this would be to set up pointers to all the > variables from libps you want to use and then only access them through > these pointers rather than directly. e.g. in libps.h there's a line > > extern int math_errno; > > You could declare > > int *pmath_errno = &math_errno; > > in your program and then access it as *pmath_errno in your code. > -- > Martin martin@snsys.com +44 117 929 9733 Hmmmm! Neat solution, Martin ;) Of course we still couldnt optimize the code module that actually assigns the address of PSDCNT etc. to the pointers as the mere mention of these variables, using optimization, turns the compiler egg-shaped. I'm not sure why this solution didnt occur to me before, although its not a problem I've dwelt on at any great length - I'll leave optimization problems until I've actually finished my project! Thanks to all who replied to my posting! Chris