comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Interfacing to C and types visible to Ada
Date: Thu, 03 Jul 2008 10:33:51 -0400
Date: 2008-07-03T10:33:51-04:00	[thread overview]
Message-ID: <wccy74jvxyo.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: ff92d09d-5638-4422-ab11-d214529c0283@l64g2000hse.googlegroups.com

Maciej Sobczak <see.my.homepage@gmail.com> writes:

> We can use Interfaces.C.int for binding Ada to C, but there is still a
> need to expose somehow the type to regular Ada code. What type should
> be used?

You can do one of:

    subtype Int is Interfaces.C.int; -- rename the type
    type Int is new Interfaces.C.int; -- declare a new type

> The Ada wrapper library might also define its own type that will be
> equivalent in range to Interfaces.C.int. What is the right name for
> such a type?

I don't know, but Integer is not a good choice, IMHO.
If you have:

    package My_Binding is
        type Integer is ...

then inside My_Binding (including its children), that Integer will hide
the one in Standard.  In other packages that say "use My_Binding;",
the Integer in Standard will hide the one in My_Binding.
You will be continually confused about which Integer you are
referring to.  And people who are familiar with Ada, but not
familiar with My_Binding will be even more confused.

- Bob



  parent reply	other threads:[~2008-07-03 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03 12:32 Interfacing to C and types visible to Ada Maciej Sobczak
2008-07-03 12:52 ` Georg Bauhaus
2008-07-03 12:58 ` Ludovic Brenta
2008-07-03 14:33 ` Robert A Duff [this message]
2008-07-03 19:19 ` tmoran
2008-07-03 19:35 ` Keith Thompson
2008-07-03 20:35   ` Maciej Sobczak
2008-07-05 20:08     ` Fionn Mac Cumhaill
2008-07-04  4:36 ` Steve
replies disabled

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