comp.lang.ada
 help / color / mirror / Atom feed
  • * Re: array type conversio question
           [not found] <352542b9.16876715@SantaClara01.news.InterNex.Net>
           [not found] ` <matthew_heaney-ya023680000304981956570001@news.ni.net>
    @ 1998-04-06  0:00 ` Anonymous
      1 sibling, 0 replies; 2+ messages in thread
    From: Anonymous @ 1998-04-06  0:00 UTC (permalink / raw)
    
    
    
    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/
    
    
    
    
    ^ permalink raw reply	[flat|nested] 2+ messages in thread

  • end of thread, other threads:[~1998-04-06  0:00 UTC | newest]
    
    Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [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 is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox