comp.lang.ada
 help / color / mirror / Atom feed
From: jeffe@hathor.CSS.GOV (Jeff Etrick)
Subject: Language Lawyers help on rep_specs
Date: 3 Jan 95 12:49:08 GMT
Date: 1995-01-03T12:49:08+00:00	[thread overview]
Message-ID: <393@hathor.CSS.GOV> (raw)


Dear Language Lawyers,

  I have the following program which will compile and execute using one vendors
Ada95 compiler and on another vendors Ada95 spits out LRM references.

The LRM references are saying that my type Nuclear_Date_Times may not be
used in a record represenation clause due to the fact it is not a simple
static expression. Talking to the vendor about this issue I was told that the
INTEGER conversion is a function and functions are not allowed in simple
static expressions.

Looking at 4.9(6) "a function_call whose function_name .........."
tells me that static functions are allowed.

My vendor insists that my program violates the LRM, could you please
enlighten me on this. Which vendor is executing this program correctly?

Thanks for the help,

Jeff
-------

with Text_IO;

procedure test
is

  -- This type is a subtype of pre-defined INTEGER, it is used
  -- for easy use of all pre-defined packages.
  -- This is a long integer range (4 bytes storage).
  subtype Full_Integer is INTEGER range -2**31..2**31 - 1;

  HOURS_IN_DAY       : constant  := 24;
  MINUTES_IN_HOUR    : constant  := 60;
  MINUTES_IN_DAY     : constant  := HOURS_IN_DAY * MINUTES_IN_HOUR;

  -- This type defines days from December 30, 1944 through December 31, 2099.
  type Dates is new Full_Integer range -1 .. 56_613;

  -- This is a single precision floating point range.
  -- This type uses the system  defined FLOAT.
  subtype Single_Float is FLOAT digits 6;


  -- This type defines minutes, the range based upon the range
  --   declared in Dates.  This represents number of minutes
  --   from the advent of the Nuclear age (1 JAN 1945, 00:00)
  type Nuclear_Date_Times is new Full_Integer
    range (INTEGER (Dates'first) - 1) * MINUTES_IN_DAY
                .. (INTEGER (Dates'last) * MINUTES_IN_DAY) - 1;


  type Header_Record_Type
  is record
    Date_Time     : Full_Integer; --Nuclear_Date_Times;
    Id            : Full_Integer;
    x             : Full_Integer;
    y             : Full_Integer;
    Latitude      : Single_Float;
    Longitude     : Single_Float;
    Elevation     : Single_Float;
    Ltrs          : STRING(1..4);
  end record;

  for Header_Record_Type
  use record at mod 4;
    Date_Time     at  0 range 0..31;
    Id            at  4 range 0..31;
    x             at  8 range 0..31;
    y             at 12 range 0..31;
    Latitude      at 16 range 0..31;
    Longitude     at 20 range 0..31;
    Elevation     at 24 range 0..31;
    Ltrs          at 28 range 0..31;
  end record;
  for Header_Record_Type'size use 32*8;


begin
 Text_Io.Put_Line("Record Layout Test");
end test;


---------------------------------------------------------------
Jeffery R. Etrick    NET  : jeffe@fisher.CSS.GOV
ENSCO INC.           MAIL : 445 Pineda Ct.  Melbourne, Fl.  32940-7506
                     PHONE: 407-254-4122
---------------------------------------------------------------



             reply	other threads:[~1995-01-03 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-03 12:49 Jeff Etrick [this message]
1995-01-03 14:50 ` Language Lawyers help on rep_specs Theodore E. Dennison
1995-01-03 16:30   ` Tucker Taft
1995-01-03 18:04   ` Robert Dewar
1995-01-03 18:07   ` Robert Dewar
1995-01-03 15:06 ` Robert Dewar
1995-01-04 14:40 ` Norman H. Cohen
replies disabled

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