comp.lang.ada
 help / color / mirror / Atom feed
* Rational Apex and RM 7.4(2)
@ 1998-08-06  0:00 x1y2z3
  1998-08-06  0:00 ` Robert Dewar
  0 siblings, 1 reply; 2+ messages in thread
From: x1y2z3 @ 1998-08-06  0:00 UTC (permalink / 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




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

end of thread, other threads:[~1998-08-06  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-06  0:00 Rational Apex and RM 7.4(2) x1y2z3
1998-08-06  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