comp.lang.ada
 help / color / mirror / Atom feed
* HELP! nested CASE statement
@ 1995-04-20  0:00 Telson Cheung
  1995-04-20  0:00 ` Garlington KE
  1995-04-20  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: Telson Cheung @ 1995-04-20  0:00 UTC (permalink / raw)


We have encountered this problem when using a debugger to step thru
one of our subprogram. Any help or sugguestion would be greatly 
appriecated.

With the following code:

---------------------------------------------------------------------
    case Hpa_Group_Status.Last_Commanded_Hpa_Band is
      when Vg_Dtypes.Band_C =>
        case Hpa_Group_Status.Last_Commanded_Hpa_Path is
          when Vg_Dtypes.Path_A =>
            Execution_Status := Hpa_C_A.Command_Execution_Status;
          when Vg_Dtypes.Path_B =>
            Execution_Status := Hpa_C_B.Command_Execution_Status;
          when others =>
            raise Invalid_Path_Id;
        end case;
      when Vg_Dtypes.Band_Ku =>
        case Hpa_Group_Status.Last_Commanded_Hpa_Path is
          when Vg_Dtypes.Path_A =>
            Execution_Status := Hpa_Ku_A.Command_Execution_Status;
          when Vg_Dtypes.Path_B =>
            Execution_Status := Hpa_Ku_B.Command_Execution_Status;
          when others =>
            raise Invalid_Path_Id;
        end case;
      when Vg_Dtypes.Band_X =>
        case Hpa_Group_Status.Last_Commanded_Hpa_Path is
          when Vg_Dtypes.Path_A =>
            Execution_Status := Hpa_X_A.Command_Execution_Status;
          when Vg_Dtypes.Path_B =>
            Execution_Status := Hpa_X_B.Command_Execution_Status;
          when others =>
            raise Invalid_Path_Id;
        end case;
      when others =>
        raise Invalid_Band_Id;
    end case;

------------------------------------------------------------------------

With the debugger, we set 
    Hpa_Group_Status.Last_Commanded_Hpa_Band := Vg_Dtypes.Band_C
    while keeping 
    Hpa_Group_Status.Last_Commanded_Hpa_Path uninitialed (ie. unknown)

when stepping thru these lines of code in the debugger, instead of raising
an Invalid_Path_Id exception, the program actually goes to 

         when Vg_Dtypes.Path_A =>
            Execution_Status := Hpa_C_A.Command_Execution_Status;

Helps needed.
Please also email response to cheung@sedsystems.ca

Thanks





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

* Re: HELP! nested CASE statement
  1995-04-20  0:00 HELP! nested CASE statement Telson Cheung
@ 1995-04-20  0:00 ` Garlington KE
  1995-04-20  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Garlington KE @ 1995-04-20  0:00 UTC (permalink / raw)


Telson Cheung (cheung@SEDSystems.ca) wrote:
: With the debugger, we set 
:     Hpa_Group_Status.Last_Commanded_Hpa_Band := Vg_Dtypes.Band_C
:     while keeping 
:     Hpa_Group_Status.Last_Commanded_Hpa_Path uninitialed (ie. unknown)

: when stepping thru these lines of code in the debugger, instead of raising
: an Invalid_Path_Id exception, the program actually goes to 

:          when Vg_Dtypes.Path_A =>
:             Execution_Status := Hpa_C_A.Command_Execution_Status;

My guess? This is because Hpa_Group_Status.Last_Commanded_Hpa_Path is
equal to Vg_Dtypes.Path_A. Every variable has to have _some_ value; this
one just happened to be Path_A.

I'll go out on this limb a little longer. I will guess that Path_A is
probably represented as zero at the machine level. Some debuggers initialize
all unitialized varaiables to a known value (like zero). In fact, I recently
tracked down a bug in a DEC Ada application involving an unitialized
variable, where the application only worked properly while being run under
the debugger, using this handy hint.

Try having the debugger display the value of Last_Commanded_Hpa_Path just
before entering this section of code.

: Helps needed.
: Please also email response to cheung@sedsystems.ca

: Thanks


--
--------------------------------------------------------------------
Ken Garlington                  GarlingtonKE@lfwc.lockheed.com
F-22 Computer Resources         Lockheed Fort Worth Co.

If LFWC or the F-22 program has any opinions, they aren't telling me.




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

* Re: HELP! nested CASE statement
  1995-04-20  0:00 HELP! nested CASE statement Telson Cheung
  1995-04-20  0:00 ` Garlington KE
@ 1995-04-20  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1995-04-20  0:00 UTC (permalink / raw)



others and undefined have nothing to do with one another, undefined, means
undefined. If you execute a case statement with an undefined value, you
get an undefined result, i.e. any result, you seem to expect some particular
result, but there is no reason to expect this.





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

end of thread, other threads:[~1995-04-20  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-04-20  0:00 HELP! nested CASE statement Telson Cheung
1995-04-20  0:00 ` Garlington KE
1995-04-20  0:00 ` Robert Dewar

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