comp.lang.ada
 help / color / mirror / Atom feed
From: Ron Thompson <thompsor@admin.tc.faa.gov>
Subject: Re: Package spec and body in C.
Date: 1997/09/26
Date: 1997-09-26T00:00:00+00:00	[thread overview]
Message-ID: <342BB433.15C6@admin.tc.faa.gov> (raw)
In-Reply-To: 342AC9A5.7CAECFA6@jpl.nasa.gov


J. M. Rayas wrote:
> 
>  Anyway, I would like to mimic Ada's package spec/body mechanism in C.
>  If anyone has done this and/or has any info that they would like to
>  share, it would be appreciated.
> 

I have done this to a variety of degrees.  The main trick is to have
each header(.h) declare itself first thing.  That way other headers
and bodies can simply ask 
if(!thing_declared)
	#include thing.h;

The c compilers of my experience have difficulty with multiple
declarations of an interface, that is, they will continue to insert
the text of that header at the include point.  Ada will allow one to
with a spec multiple times.

Making null return functions so they look like procedures is another
need.

Using pointers as "in out" or "out" parameters is yet another tricky
matter, but doable.

Just a couple of rusty pennies from a lone Ada programmer.
-- 

rct

The opinions above are mine and mine alone.




  reply	other threads:[~1997-09-26  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-25  0:00 Package spec and body in C J. M. Rayas
1997-09-26  0:00 ` Ron Thompson [this message]
1997-09-30  0:00   ` Simon Wright
1997-09-29  0:00 ` Eric W. Nikitin
replies disabled

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