comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Passing a String to a C/C++ Subprogram (Special Case)
Date: Wed, 16 Oct 2013 08:14:32 -0700
Date: 2013-10-16T08:14:32-07:00	[thread overview]
Message-ID: <l3mago$atq$1@dont-email.me> (raw)
In-Reply-To: <xu4wlscuj3cj$.1a80u8el1oboi$.dlg@40tude.net>

On 10/16/2013 12:17 AM, Dmitry A. Kazakov wrote:
>
> procedure Foo (A : String) is
>     procedure C_Prog (C_String : Address);
>     pragma Import (...);
>     pragma Assert (Character'Size = char'Size); -- sic!
> begin
>     C_Prog (A (A'First)'Address);

This will fail on a number of compilers. An Ada Address is not necessarily the 
same as a C pointer.

-- 
Jeff Carter
"When Roman engineers built a bridge, they had to stand under it
while the first legion marched across. If programmers today
worked under similar ground rules, they might well find
themselves getting much more interested in Ada!"
Robert Dewar
62

  reply	other threads:[~2013-10-16 15:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 19:54 Passing a String to a C/C++ Subprogram (Special Case) Eryndlia Mavourneen
2013-10-15 20:11 ` Adam Beneschan
2013-10-15 21:02   ` Eryndlia Mavourneen
2013-10-16  7:17     ` Dmitry A. Kazakov
2013-10-16 15:14       ` Jeffrey Carter [this message]
2013-10-16 17:32     ` Martin
2013-10-16 17:42       ` Eryndlia Mavourneen
2013-10-16 17:54         ` Martin
2013-10-16 18:13           ` Eryndlia Mavourneen
2013-10-16 19:40             ` Simon Wright
2013-10-16 20:02               ` Eryndlia Mavourneen
2013-10-19  2:11           ` Randy Brukardt
2013-10-16 19:11       ` Adam Beneschan
2013-10-16 21:31         ` Martin
2013-10-16 21:41           ` Adam Beneschan
2013-10-16 23:15             ` Martin
2013-10-15 20:59 ` Jeffrey Carter
2013-10-15 21:13   ` Eryndlia Mavourneen
2013-10-15 22:19     ` Shark8
2013-10-16  0:00     ` Jeffrey Carter
2013-10-17  9:55     ` Georg Bauhaus
2013-10-16 20:17 ` sbelmont700
2013-10-16 20:48   ` Adam Beneschan
2013-10-17 13:05     ` Eryndlia Mavourneen
2013-10-17 13:58       ` sbelmont700
2013-10-17 16:28         ` Eryndlia Mavourneen
replies disabled

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