From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5f748ee50b1a42ac X-Google-Attributes: gid103376,public From: Ron Thompson Subject: Re: Package spec and body in C. Date: 1997/09/26 Message-ID: <342BB433.15C6@admin.tc.faa.gov>#1/1 X-Deja-AN: 275753633 References: <342AC9A5.7CAECFA6@jpl.nasa.gov> Organization: FAA Technical Center, Pomona, NJ Newsgroups: comp.lang.ada Date: 1997-09-26T00:00:00+00:00 List-Id: 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.