comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: The Dreaded "Missing Subunits"
Date: Wed, 18 Sep 2002 20:56:18 GMT
Date: 2002-09-18T20:56:18+00:00	[thread overview]
Message-ID: <wccptvb9fv1.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 4519e058.0209160548.461cef27@posting.google.com

dennison@telepath.com (Ted Dennison) writes:

> Simon Wright <simon@pushface.org> wrote in message news:<x7vu1kss4q2.fsf@pushface.org>...
> > Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> > 
> > > The sad thing is that although Ada is very portable in many
> > > respects, the community of compiler vendors can't agree on
> > > file-naming conventions.  Contrast with C, where everybody knows
> > > what .h and .c mean.
> > 
> > Is this a joke?

No, I wasn't joking.

>... cos it's clear that .h and .c have absolutely _no_
> > semantic content!

Sure they do -- to programmers.  The "semantic content" is merely a
convention, not enforced by compilers.  But that's OK -- at least
you can write a bunch of .c and .h files, using the normal convention,
and expect it to compile using *any* C compiler.

I realize that in rare cases, C programmers violate the convention.
But these cases are very rare indeed, in my experience.

Contrast with Ada, where GNAT wants .ads/.adb, Rational wants
.1.ada/.2.ada, and AdaMagic wants .spc/.bdy.  I know GNAT and AdaMagic
have ways of overriding the convention (not sure about Rational),
but you have to go to extra trouble to use a convention different
from what the compiler wants.  Wouldn't it be better if all Ada
compilers supported the same file-naming conventions out of the box,
without using nonstandard pragmas Source_File_Name and the like?

What file-naming convention should I use, if I want to be
portable across all compilers?  For C, the answer is easy.
For Ada, it's not.

> It must be. The problem is that most folks *think* they know what
> those extensions mean, but the compiler could care less what you
> think.

But *all* C compilers are capable of compiling C programs consisting of
the usual .c and .h files, without any extra trouble.

> For instance, Tornado (the vxWorks development enviroment) comes with
> quite a few .c files that are "#include"d rather than compiled. Good
> luck figuring that out!

Beside the point.

> And of course most folks feel that C++ should have its own extensions,
> but there is little agreement on what they should be.

Yes, but I hope you're not one of those folks who think C/C++ is a
language.  ;-)  C and C++ do share some problems.  (As one of the
designers who turned Ada 83 into Ada 95, I feel some kinship with Bjarne
Stroustrup!  Upward compatibility is not easy.)  But for this particular
issue, C wins (even though the convention is "merely" a cultural
convention, and is sometimes violated) -- *I* didn't mention C++.

>... ".cpp" seems
> common, but I've also seen ".C" and ".cc". The extension ".c" is
> sometimes used to mean code that is purposely C compatable, while
> sometimes its used for C++-only files. For headers I've seen
> personally or seen suggested ".h", ".hpp", ".d", "..c", ".hh", and
> ".icc" (for inline header files). The C++ standard itself specifies
> that quite a few header files have no extension at all!
> 
> Of course no matter what you use, the compiler won't care a bit, and
> will happily include a ".cpp" or compile a ".hpp", if you tell it to
> and the syntax passes.

I guess that's my point: most Ada compilers *do* care, and they favor
*different* conventions.  At least in C++ you can *choose* some
convention that works easily on all compilers.

> References: http://www.cs.umd.edu/users/cml/cstyle/

- Bob



  parent reply	other threads:[~2002-09-18 20:56 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12 22:49 The Dreaded "Missing Subunits" Peter Richtmyer
2002-09-13  8:16 ` Peter Amey
2002-09-13  8:51   ` Ada2005 temp solo child (was: " Peter Hermann
2002-09-14  2:33     ` Robert A Duff
2002-09-13  9:24   ` Emmanuel Briot
2002-09-13 20:46     ` Simon Wright
2002-09-14  0:25     ` Chad R. Meiners
2002-09-14  2:53     ` Robert A Duff
2002-09-14 20:20       ` Simon Wright
2002-09-16 13:48         ` Ted Dennison
2002-09-16 16:33           ` Keith Thompson
2002-09-17  2:42             ` Ted Dennison
2002-09-18 20:56           ` Robert A Duff [this message]
2002-09-19  8:26             ` Emmanuel Briot
2002-09-19  9:55             ` Preben Randhol
2002-09-19 10:53             ` Marc A. Criley
2002-09-19 11:26             ` Marin David Condic
2002-09-19 21:49             ` Dmitry A.Kazakov
2002-09-19  9:47               ` Preben Randhol
2002-09-20  2:42                 ` Dmitry A.Kazakov
2002-09-19 15:33                   ` Stephen Leake
2002-09-19 15:36                   ` Preben Randhol
2002-09-20 22:31                     ` Dmitry A.Kazakov
2002-09-16 15:10       ` Emmanuel Briot
2002-09-18 21:17         ` Robert A Duff
2002-09-18 22:41           ` Stephen Leake
2002-09-19  0:00             ` Robert A Duff
2002-09-19  1:39               ` Keith Thompson
2002-09-19 15:19                 ` Stephen Leake
2002-09-19  4:02               ` Larry Kilgallen
2002-09-19 15:24               ` Stephen Leake
2002-09-19 20:34               ` Randy Brukardt
2002-09-19 14:44           ` Peter Richtmyer
2002-09-19 20:25           ` Randy Brukardt
2002-09-13 17:15 ` Mark Johnson
2002-09-13 20:56 ` Stephen Leake
2002-09-13 20:58 ` Simon Wright
2002-09-16 17:28   ` Peter Richtmyer
2002-09-19 20:05     ` Brian Gaffney
  -- strict thread matches above, loose matches on Subject: below --
2002-09-19  1:41 Alexandre E. Kopilovitch
2002-09-19 14:25 ` Peter Hermann
2002-09-19 11:37 Grein, Christoph
2002-09-20  6:03 Grein, Christoph
2002-09-20  7:30 ` Preben Randhol
2002-09-20 14:01   ` Robert A Duff
2002-09-20  9:05 Grein, Christoph
replies disabled

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