comp.lang.ada
 help / color / mirror / Atom feed
From: nobody@REPLAY.COM (Anonymous)
Subject: Re: array type conversio question
Date: 1998/04/06
Date: 1998-04-06T00:00:00+00:00	[thread overview]
Message-ID: <199804061400.QAA01523@basement.replay.com> (raw)
In-Reply-To: 352542b9.16876715@SantaClara01.news.InterNex.Net


On Fri, 03 Apr 1998 20:13:15 GMT, tmoran@bix.com (Tom Moran) wrote:

> How can I make the following into legitimate Ada 95 code?
> with interfaces.c;
> procedure test is
>   use interfaces.c;
>   type t is array(1 .. 5) of aliased char;
>   type r is record
>     title : t := t(to_c("abc") & (4 .. 5=>nul));
>     stuff : integer;
>   end record;
> begin
>   null;
> end test;
> ...

The following is legal according to GNAT 3.10p1/Win95:

with interfaces.c;
procedure test is
  type t is array(1 .. 5) of aliased interfaces.c.char;
  type r is record
    title : t := "abc" & (4 .. 5=>interfaces.c.nul);
    stuff : integer;
  end record;
begin
  null;
end test;

"Pesky use clauses," said Pooh.

Interfaces.C.Char is a character type; therefore, T is a string type;
that is, it is a one-dimensional array with components of a character
type. String literals are defined for all string types.

Eliminating the use clause eliminated potential ambiguity of "&",
allowing this to compile cleanly.

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"English bed-wetting types."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/




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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <352542b9.16876715@SantaClara01.news.InterNex.Net>
     [not found] ` <matthew_heaney-ya023680000304981956570001@news.ni.net>
1998-04-04  0:00   ` array type conversio question Tom Moran
1998-04-06  0:00 ` Anonymous [this message]
replies disabled

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