This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposal for automatic generation of c++ header files


On 1/14/2011 11:18 AM, Achilleas Margaritis wrote:
On Fri, Jan 14, 2011 at 6:20 PM, Richard Kenner
<kenner@vlsi1.ultra.nyu.edu>  wrote:
The Ada people call their headers 'specifications', because a lot of
program specifications are placed in those headers.

But they are not specifications in a sense that you can have multiple
implementations of them. I.e. there is a 1-to-1 correspondence between
Ada package declarations and package bodies.

Feel free to correct me if I am mistaken.

You are mistaken. ;-)

I am not mistaken. For a single Ada program that compiles successfully, there is 1-to-1 correspondence of a package declaration and package body.

In a particular link, yes, in the non-generic case, but of course if you use generics you can achieve the effect of multiple bodies.

But I don't think you know how Ada
is used at all with respect to this feature (I suspect you have
never built or worked with a large Ada application).

It's not uncommon to have multiple different implementations of the
same specification, for example for different target architectures or
one might be production and the other development.

That's what conditional compilation, modules and build systems are for.

But as every Ada programmer knows, doing it with separate specs and bodies is FAR more straight forward and far easier. For an extensive example study the Ada run-time example, and by the way study a-adaint.c in the same run-time for an example of how not to do things (a-adaint.c is full of conditional target dependent cconditional compilation and is unfortunatrely a bit of a mess)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]