comp.lang.ada
 help / color / mirror / Atom feed
* strange problem.Help pleeeeeeeeeese
@ 2002-06-21  5:32 Ashwath
  2002-06-21  7:27 ` David Marceau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ashwath @ 2002-06-21  5:32 UTC (permalink / raw)


Hello,
I am facing a peculiar problem while testing Ada procedure.
The procedure has a variable which is local to it and it is of type
called T_REPORT.T_REPORT is a enumeration type and it contains 3
values CORRECT,DEFINED and UNDEFINED and is defined in another generic
package called BLACK_BOARD.Now That local variable is passed to some
procedure which will set it to the value CORRECT.After invoking that
procedure the local variable is compared as follows
if LOCAL_VARIABLE /= REPORT_BDS.CORRECT then
.....
.....
else
....
....
end if;
Note that REPROT_BDS is instantiation of the package BLACK_BOARD.
While debugging, the execution is going to the else part.Please let me
know what might be the problem?
Sorry the post is little big.I thougt to give all the details so that
it is easy for u ppl to analyse.Pls reply as soon as possible, it is
very urgent.
Thanks



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: strange problem.Help pleeeeeeeeeese
  2002-06-21  5:32 strange problem.Help pleeeeeeeeeese Ashwath
@ 2002-06-21  7:27 ` David Marceau
  2002-06-21 11:44 ` Antonio Duran
  2002-06-24 14:03 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: David Marceau @ 2002-06-21  7:27 UTC (permalink / raw)


Ashwath wrote:
> 
> Hello,
> I am facing a peculiar problem while testing Ada procedure.
> The procedure has a variable which is local to it and it is of type
ok a first level proc here.

> called T_REPORT.T_REPORT is a enumeration type and it contains 3
> values CORRECT,DEFINED and UNDEFINED and is defined in another generic
> package called BLACK_BOARD.Now That local variable is passed to some
> procedure which will set it to the value CORRECT.After invoking that
ok a second level proc here.
My guess is maybe your procedure parameter declaration for this second
level proc
is not "in out" for the one that you pass LOCAL_VARIABLE to.  
If it's just in, you could probably guess that it would not change.  
Fix it to "in out".

> procedure the local variable is compared as follows
ok back to the first proc you do an if. Fine.

> if LOCAL_VARIABLE /= REPORT_BDS.CORRECT then
> .....
> .....
> else
> ....
> ....
> end if;
> Note that REPROT_BDS is instantiation of the package BLACK_BOARD.
> While debugging, the execution is going to the else part.Please let me
> know what might be the problem?
So you're in gdb.
info locals on the line before entering the second level proc.
info locals after next'ing over this second level proc.
-If LOCAL_VARIABLE changed as expected then your second level proc has
an "in out" spec for your parameter that you passed LOCAL_VARIABLE
into.  
	That means the problem really is your if statement. 
-If LOCAL_VARIABLE did not change as expected then your second level
proc is the source of your problem.  
	Change the spec for the parameter to "in out".  If that's not the issue
then it's in the body of the second level procedure or even lower.

Sant� bonheur,
David Marceau



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: strange problem.Help pleeeeeeeeeese
  2002-06-21  5:32 strange problem.Help pleeeeeeeeeese Ashwath
  2002-06-21  7:27 ` David Marceau
@ 2002-06-21 11:44 ` Antonio Duran
  2002-06-24 14:03 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Antonio Duran @ 2002-06-21 11:44 UTC (permalink / raw)


vashwathus@yahoo.com (Ashwath) wrote in message news:<14763faf.0206202132.14bb4f04@posting.google.com>...
> Hello,
> I am facing a peculiar problem while testing Ada procedure.
> The procedure has a variable which is local to it and it is of type
> called T_REPORT.T_REPORT is a enumeration type and it contains 3
> values CORRECT,DEFINED and UNDEFINED and is defined in another generic
> package called BLACK_BOARD.Now That local variable is passed to some
> procedure which will set it to the value CORRECT.After invoking that
> procedure the local variable is compared as follows
> if LOCAL_VARIABLE /= REPORT_BDS.CORRECT then
> .....
> .....
> else
> ....
> ....
> end if;
> Note that REPROT_BDS is instantiation of the package BLACK_BOARD.
> While debugging, the execution is going to the else part.Please let me
> know what might be the problem?
> Sorry the post is little big.I thougt to give all the details so that
> it is easy for u ppl to analyse.Pls reply as soon as possible, it is
> very urgent.
> Thanks

LOCAL_VARIABLE is set to CORRECT in the procedure, so the statement
LOCAL_VARIABLE /= CORRECT is False (LOCAL_VARIABLE became CORRECT) so
it must enter in the else part.

   Antonio Duran



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: strange problem.Help pleeeeeeeeeese
  2002-06-21  5:32 strange problem.Help pleeeeeeeeeese Ashwath
  2002-06-21  7:27 ` David Marceau
  2002-06-21 11:44 ` Antonio Duran
@ 2002-06-24 14:03 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Leake @ 2002-06-24 14:03 UTC (permalink / raw)


vashwathus@yahoo.com (Ashwath) writes:

> Hello,
> I am facing a peculiar problem while testing Ada procedure.
> The procedure has a variable which is local to it and it is of type
> called T_REPORT.T_REPORT is a enumeration type and it contains 3
> values CORRECT,DEFINED and UNDEFINED and is defined in another generic
> package called BLACK_BOARD.Now That local variable is passed to some
> procedure which will set it to the value CORRECT.After invoking that
> procedure the local variable is compared as follows
> if LOCAL_VARIABLE /= REPORT_BDS.CORRECT then
> .....
> .....
> else
> ....
> ....
> end if;
> Note that REPROT_BDS is instantiation of the package BLACK_BOARD.
> While debugging, the execution is going to the else part.Please let me
> know what might be the problem?

You haven't said what you expected to happen instead, nor why. It
helps to be very clear here.

> Sorry the post is little big.

Actually, this post is quite small. 

> I thougt to give all the details so that it is easy for u ppl to
> analyse.Pls reply as soon as possible, it is very urgent. 

Sounds like this is homework; if so, it is polite to say so.

In general, it is much easier to answer questions like this if you
post the code.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-06-24 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-21  5:32 strange problem.Help pleeeeeeeeeese Ashwath
2002-06-21  7:27 ` David Marceau
2002-06-21 11:44 ` Antonio Duran
2002-06-24 14:03 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox