comp.lang.ada
 help / color / mirror / Atom feed
From: Dave Thompson <david.thompson1@worldnet.att.net>
Subject: Re: Using GNU make with ObjectAda
Date: Mon, 15 Sep 2003 04:16:10 GMT
Date: 2003-09-15T04:16:10+00:00	[thread overview]
Message-ID: <tpq8mvgrsc8v8sk404qqnkmunrfg7lbeqa@4ax.com> (raw)
In-Reply-To: m3k78mnftg.fsf@insalien.org

On 06 Sep 2003 16:37:31 +0200, Ludovic Brenta
<ludovic.brenta@skynet.be> wrote:

> "Tim Spargo" <tim.spargo@NO_SPAMsympatico.ca> writes:
<snip>
> Not true.  Make files were invented only to overcome the shortcomings
> of the C language with respect to separate compilation, and C++
> happily kept these shortcomings.
> 
The make tool and its files were invented originally in the Unix
environment primarily for C, but FORTRAN of the day had the same
issues which make also could be and was used to solve.  So did most if
not all assemblers, and PL/I, which were all of the languages you were
likely to separately compile and link together other than COBOL, which
partly evaded the issue by having only character-structured data, and
maybe Pascal, which mostly had its own private tools.

C++ didn't directly set out to fix any of these issues, but in order
to provide overloaded functions the original implementation and AFAIK
all since use(d) name mangling which provides *partial* checks on
consistency for functions, but not for class contents (members), and
particularly the classes functions/methods operate on.

<snip>
> In Ada, separate compilation, as well as the rules for consistency,
> are defined by the language (the ARM devotes the entire Chapter 10,
> "Program Structure and Compilation Issues", to this).
> 
> In C and C++, separate compilation is defined not by the language but
> by the particular tools ("make" and linker) you use.  For example, the
> ISO C99 standard defines the "extern" keyword (6.2), external
> definitions (6.9), and the #include preprocessor directive (6.10.2)

All keywords as such are in 6.4.1, and the syntax(es) using the extern
keyword are in 6.7.1 and 6.9.1; but it is actually external *linkage*
that matters, defined by 6.2.2 and 6.7.1 (and a little bit by 6.7.4),
and linkage is only loosely, er, linked to the keyword:  you can have
external linkage without using the keyword, and in some particularly
silly cases you can use the keyword without getting external linkage.
Note that 6.9 "external definitions" really means library-level (Ada)
or file-scope (C), not necessarily external in the sense of crossing
compilation units.

> but does not define how object files must be linked together, much
> less any rules for consistency.  

It does give rules requiring the *program* to be consistent about
(external) functions and variables, primarily 6.5.2.2 and 6.5
respectively.  (Remember in C function includes procedure.) What it
does not require is any implementation (compiler, linker, etc.)
support for checking them, and in fact such support is very rarely
provided, although it is *legal* to do so.

(An implementation *is* required to check consistency *within* a
compilation unit and scope -- as you would minimally expect -- for
variables and for functions using the "modern" 1980s prototype syntax
but not for the legacy "K&R1" 1970 syntax.)

> "make" provides you with a separate
> language and interpreter (very different from C) that allows you to
> describe the relationships between your source and object files.  Not
> only is "make" not part of C/C++, you can even use alternatives such
> as "ant" or "cook".
> 
Agree there.  

> As P.J. Plaugher once said, "above 100,000 lines of code, we should
> all be coding in Ada".

Plauger.  The h belongs in Kernighan.  Or perhaps Knuth. :-)

- David.Thompson1 at worldnet.att.net



  parent reply	other threads:[~2003-09-15  4:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-04 22:16 Using GNU make with ObjectAda Tim Spargo
2003-09-05 12:13 ` Georg Bauhaus
2003-09-06 12:21   ` Tim Spargo
2003-09-06 13:00     ` Marin David Condic
2003-09-06 14:37     ` Ludovic Brenta
2003-09-07 20:42       ` Robert I. Eachus
2003-09-15  4:16       ` Dave Thompson [this message]
2003-09-06 20:42 ` Guillaume Foliard
2003-09-08 13:48   ` Stephen Leake
2003-09-08 22:22     ` Guillaume Foliard
2003-09-09  0:05       ` Ludovic Brenta
2003-09-09 13:38       ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-09-08  9:00 Lionel.DRAGHI
replies disabled

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