comp.lang.ada
 help / color / mirror / Atom feed
From: Bob Wells #402 <wel@EUROCONTROL.DE>
Subject: Range Check Query
Date: Fri, 18 Nov 1994 16:27:49 +0100
Date: 1994-11-18T16:27:49+01:00	[thread overview]
Message-ID: <9411181527.AA08827@eurocontrol.de> (raw)

G'day everyone,
Hope you're all having a lovely Friday!

Why does the following not raise a Constraint_Error exception?
(It doesn't even raise a compile time warning)

  type dn18906 is  -- layout is for the 18906 message  .
    record
      dnspare  : integer range 0 .. 1;
      dnspare2 : integer range 0 .. 3;
      dnch1    : integer range 0 .. (2**7) - 1;
      dnch2    : integer range 0 .. (2**7) - 1;
    end record;

   for dn18906 use
     record at mod 1;
       dnspare at 0 range 0 .. 1;
       dnspare2 at 0 range 2 .. 7;
       dnch1 at 0 range 8 .. 15;
       dnch2 at 0 range 16 .. 23;
     end record;

   for dn18906'size use 24;

   type Dn_189_Data is array(1 .. N_Data) of Dn18906;
   pragma Pack(Dn_189_Data);

   M_T : Dn_189_Data;
   for M_T use at P_Mesg_Conv(P_Ohead) + 12;

P_Mesg_Conv is an Unchecked_Conversion of an access type to a
system address. The access type points to an incoming byte
stream.

As Bart Simpson says "I didn't do it, I didn't do it!" That is,
I've been "lucky" enough to inherit this code.


OK, then in the body of this package we have:


   if M_T(1).Dnspare = 2 then

--     do something

   end if;

The incoming stream definitely has value of 2 occaisionaly in this
component yet it doesn't raise Constraint_Error?

Once again we are using the

Verdix Ada Compiler, Copyright 1984, 1992
VADSworks for Sun-4 -> MC68020/30/vxWorks, (VADS 6.0.5)
Mon Aug 17 09:11:00 EST 1992 2.0.3(b)

Any help would be greatly appreciated. Thanks and 'avagoodweegend!

@                   --------
@          ////  - ( G'day! )
@         (o o)     --------
@ ----oOO--(_)--OOo--------------------------------------------------------
  Bob Wells                      "There are more things in heaven and earth
                                  than are dreamt of in your philosophy."
@ INTERNET: wel@eurocontrol.de                 CompuServe:      100272,3004
@ The Ada WWW Server is http://lglwww.epfl.ch/Ada/                 Team Ada
@ For exciting Ada info enter 'finger wel@s4ecawel.eurocontrol.de'



             reply	other threads:[~1994-11-18 15:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-18 15:27 Bob Wells #402 [this message]
1994-11-18 12:11 ` Range Check Query Robert I. Eachus
1994-11-19 16:58   ` Robert Dewar
1994-11-21 10:57     ` Robert I. Eachus
1994-11-20 17:16 ` Do-While Jones
1994-11-21 16:00 ` Norman H. Cohen
1994-11-23 17:31 ` Kent Mitchell
replies disabled

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