>From: Mickey Mathieson <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: [c-prog] confused with struct?
>Date: Thu, 22 Mar 2007 11:35:09 -0700 (PDT)
>
>
>--- glogic_1 <[EMAIL PROTECTED]> wrote:
>
> > Hey all
> > K this is the problem.. I have a CaveArray[][]made
> > up of the
> > following struct. when i refer to the bool members
> > of it to test if
> > it is true or false it always skips the code
> > following.
> >
> > struct cave { //template of each cave
> > bool North ;
> > bool South ;
> > bool East ;
> > bool West ;
> > bool Wumpus ;
> > bool NewWumpus;
> > bool Hole ;
> > bool Arrows ;
> > bool Lives ;
> > bool CaveFound;
> >
> >
> >
> > } CaveArray [IROW][ICOL] ;
> >
> > e.g.
> > if ( Maze[iX][iY].North == true )
> > {
> > if ( Maze[iX-1][iY].Hole == true )
> > //even though this expression is
> > true it never goes
> > into the following code it just skips on.. ive put
> > watches on all
> > the CaveArray and stepped through the code and then
> > the expression
> > is highlighted it says its true but still skips the
> > code anyway
> > {
> > bHole = true;
> > }
> > }
> > iX and iY are always within the array size
> >
> > any ideas why this is??
> > Cheers
> > g
> >
> >
>
>Is BHole being referenced anywhere in the program?
at the start of the function i declare bHole as being false. then if
Maze[iX-1][iY].Hole == true i flag bHole as being true. which is used later
in the function to output the relevent txt to the screen.
It is used later in the code so that would mean that the problem is not
because its being optimized right? im using borland builder 6 and that warns
when there are unsued variables but im getting no warnings either
>
>I would suspect that bHole is being optimized out of
>the code because its of no use to the program.
>
>If the program below is optimized it will exclude the
>second code block.
>
>
>int main()
>{
> bool a = true;
> bool b = true;
> bool c = true;
>
> if (a)
> {
> if (b)
> {
> bvalue = true;
> }
> }
>
> return 0;
>}
>
>try turning off optimization or reference bHole
>somewhere in the program.
>
>
>
>Mickey M.
>Construction Partner Inc.
>http://www.constructionpartner.com
>
>
>
>____________________________________________________________________________________
>Looking for earth-friendly autos?
>Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
>http://autos.yahoo.com/green_center/
_________________________________________________________________
5.5%* 30 year fixed mortgage rate. Good credit refinance. Up to 5 free
quotes - *Terms
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h2a5d&s=4056&p=5117&disc=y&vers=910