--- GLOGIC 20 <[EMAIL PROTECTED]> wrote:
>
>
>
> >From: Mickey Mathieson <[EMAIL PROTECTED]>
> >Reply-To: [email protected]
> >To: [email protected]
> >Subject: Re: [c-prog] confused with struct?
> >Date: Thu, 22 Mar 2007 13:47:24 -0700 (PDT)
> >
> >
> >--- GLOGIC 20 <[EMAIL PROTECTED]> wrote:
> >
> > >
> > >
> > >
> > > >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
> > >
> >
> >Try placing a printf or MessageBox(depending on
> >program type) in the code block and see if it gets
> >invoked.
> >
> >Make sure optimization is off - its on the option
> page
> >for borland 6.0 IDE.
>
>
> hey Mickey
> Yeah i already tried putting outputs in the code
> block to see if it worked
> but nothing was output
> and i just checked that optomization thing u were
> talking about and its set
> to none
> i asked lecturer today what the problem was and he
> couldnt work it out
> either so he just walked away after awhile!
> thanks for the help
> g
> >
> >Mickey
> >
> >
Make sure your set for a "Debug Build" - its in the
option page and then do a complete build.
Debug information should be on.
Line number information should be on.
Disable inline expansion should be on.
Optimization = none
Its easiest to just lick the debug build button.
Mickey
> > > >
> > > >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
> > >
> > >
> >
> >
> >
> >
>
>____________________________________________________________________________________
> >Now that's room service! Choose from over 150,000
> hotels
> >in 45,000 destinations on Yahoo! Travel to find
> your fit.
> >http://farechase.yahoo.com/promo-generic-14795097
>
>
=== message truncated ===
____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367