[comp.lang.c++] filenames for C++

henry@utzoo.uucp (Henry Spencer) (04/24/88)

>	.C	??	AT&T
>	.c	.h	Guideleines
>	.cc	??	Gnu
>	.cxx	.hxx	Advantage
>	.cpp	.hpp	Zortech

Of these, I would say that Gnu's .cc is the clear winner.  It is not case-
sensitive, it distinguishes C++ code from C code, and within those
constraints it is the shortest (i.e. it infringes least on the name space
on systems with limited filename length) and the easiest to type.

There is no need for a new naming convention for header files, actually.
Assuming sane programmers, C++ programs will contain only #includes
referring to C++ header files (or C++-compatible C header files) and C
programs will contain only #includes referring to C header files.  The
only place where there is a real conflict is in library header files, and
the obvious way to handle them is by using two distinct library directories.
Actually it might have been better to use a new naming convention so things
could be together in one directory, but it's a bit late for that, as I
believe there are already conflicts (I'm a C++ novice and my copy of The
Book isn't handy, but I seem to recall stdio.h and some others).  If a
new convention were necessary, it should be analogous to the source-file
convention (e.g. .hh if the sources are .cc).
-- 
"Noalias must go.  This is           |  Henry Spencer @ U of Toronto Zoology
non-negotiable."  --DMR              | {ihnp4,decvax,uunet!mnetor}!utzoo!henry

smith@analog.UUCP (Tom Smith) (04/26/88)

In article <1988Apr24.085957.8413@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes:
> >	.C	??	AT&T
> >	.c	.h	Guideleines
> >	.cc	??	Gnu
> >	.cxx	.hxx	Advantage
> >	.cpp	.hpp	Zortech
> 
> There is no need for a new naming convention for header files, actually.
> Assuming sane programmers, C++ programs will contain only #includes
> referring to C++ header files (or C++-compatible C header files) and C
> programs will contain only #includes referring to C header files.

In order to utilize UNIX system include files in C++ programs without
porting them, one must be able to distinguish between a K&R external
declaration and an ANSI C/C++ function template.  Common UNIX header
files, such as stdio.h, are usually ported for us hapless software
writers and provided along with the compiler/translater.

A fair amount of effort is being put into maintaining as much backward
compatibility with both ANSI and K&R C as possible by the
compiler/translater writers, in order to speed porting and help the
language catch on a bit.  Some compilers/translaters, such as
Glockenspiel's C++ (a downstream version of AT&T that used the .cxx/.hxx
'convention'), will take different actions based on the header file suffix.

Thomas H. Smith  {hplabs, ucbvax!sun}!analog

echrzanowski@watmath.waterloo.edu (Edward Chrzanowski) (04/26/88)

In article <1988Apr24.085957.8413@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes:
> >	.C	??	AT&T
> >	.c	.h	Guideleines
> >	.cc	??	Gnu
> >	.cxx	.hxx	Advantage
> >	.cpp	.hpp	Zortech
> 
> Of these, I would say that Gnu's .cc is the clear winner.  It is not case-
> sensitive, it distinguishes C++ code from C code, and within those
> constraints it is the shortest (i.e. it infringes least on the name space
> on systems with limited filename length) and the easiest to type.

Here at the University of Waterloo we alredy use the .cc extension.  There are
no conflicts.  All it took was a couple of changes to the shell script.  For
compiling we use "ccc" for c++ programs.

franka@mmintl.UUCP (Frank Adams) (04/29/88)

In article <179@ward.analog.UUCP> smith@analog.UUCP (Tom Smith) writes:
|In article <1988Apr24.085957.8413@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes:
|> There is no need for a new naming convention for header files, actually.
|> Assuming sane programmers, C++ programs will contain only #includes
|> referring to C++ header files (or C++-compatible C header files) and C
|> programs will contain only #includes referring to C header files.
|
|In order to utilize UNIX system include files in C++ programs without
|porting them, one must be able to distinguish between a K&R external
|declaration and an ANSI C/C++ function template.

Also, when using an intelligent editor, it is useful to be able to tell the
difference between C++ files and C files.  For example, when checking that
braces are matched, one needs to know what kind of comments are possible.
-- 

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108