comp.lang.ada
 help / color / mirror / Atom feed
From: x1y2z3@my-dejanews.com
Subject: Rational Apex and RM 7.4(2)
Date: 1998/08/06
Date: 1998-08-06T00:00:00+00:00	[thread overview]
Message-ID: <6qbomp$s9k$1@nnrp1.dejanews.com> (raw)

Hi,

we have some code containing deferred constants which are imported from
C. Gnat has no trouble with this, however I was told by a client that
their Rational Apex compiler did not like those constants (I don't know
of any specific error messages).

The RM says in 7.4(2)  "A deferred constant declaration requires a
completion, which shall be a full constant declaration ([...]), or a
pragma Import (see Annex B).", so what we are doing seems ok.

Has anyone else come across this problem (if it is a problem), or are
we doing something "naughty"?

  package A is
    ...
    package B is
       type Foo is private;
       ...
    private
       type Foo is new System.Address;
    end B;

    Bar : constant B.Foo;
    ...
  private
    pragma Import (C, Bar, "C_Bar");
  end A;

A workaround for Apex is to declare a variable in A's private part,
Import that and use the variable to complete the constant:

  private
    Temp_Bar : B.Foo;
    pragma Import (C, Temp_Bar, "C_Bar");
    Bar : constant B.Foo := Temp_Bar;
  end A;

This gets rather verbose when setting up a dozen constants. Any
better ideas?

Andrew.

--
+----------------------------------------------------------------------+
| Andrew Lynch, MEng (York) / lynch@cci.de | Run, run, as fast as you  |
| CCI GmbH                 /alynch@iee.org | can. You can't catch me,  |
| Lohberg 10       _______/ lyncha@acm.org | I'm the gingerbeard man!  |
| D-49716 Meppen  / Tel. ++49 5931 805-243 |       .sig by Anna Gramme |
+----------------------------------------------------------------------+

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




             reply	other threads:[~1998-08-06  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-06  0:00 x1y2z3 [this message]
1998-08-06  0:00 ` Rational Apex and RM 7.4(2) Robert Dewar
replies disabled

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