[comp.lang.c++] File Name Extensions

jordan@cs.columbia.edu (Jordan Hayes) (05/09/89)

Jeff Bowden <jeffb@grace.cs.washington.edu> writes:

	Personally I just use the ".c" extension and let my Makefile
	take care of the details (can you say "CC=g++"?)

Can you say `works only in the trivial case' ...?

What if you have C && C++ source in the same Makefile?

Thank god for GNU Make or "make depend" would be a headache ...

/jordan

ps: here's mine ...

-----
GCC		= gcc
CC		= ${GCC}
C++		= g++
C++SRCS		=$(wildcard *.cc)
C++DEP		=${C++} ${CPPFLAGS} -MM
CSRCS		=$(wildcard *.c)
CDEP		=${CC} ${CPPFLAGS} -MM

cdep:
	  for i in ${CSRCS} ;\
	    do \
	      ${CDEP} $$i >> DEPEND ;\
	    done

c++dep:
	  for i in ${C++SRCS} ;\
	    do \
	      ${C++DEP} $$i >> DEPEND ;\
	    done

ifneq "${CSRCS}" ""
DEP	= cdep
else
DEP	=
endif

ifneq "${C++SRCS}" ""
ADEP	= ${DEP} c++dep
else
ADEP	= ${DEP}
endif

depend:
	echo > DEPEND
	make ${ADEP}

include DEPEND
-----

cberrett@tau.sim.es.com (Craig Berrett) (06/28/91)

There seems to be a variety of  different file extensions used to
indicate that a
file is a c++ source or header file .  At this time is there any
consensus as to the
naming convention that should be used? What is currently in use for
these c++
file extensions? 

				Thank You,
					Craig

steve@taumet.com (Stephen Clamage) (06/28/91)

cberrett@tau.sim.es.com (Craig Berrett) writes:

>There seems to be a variety of  different file extensions used to
>indicate that a file is a c++ source or header file .
>At this time is there any consensus as to the
>naming convention that should be used? What is currently in use for
>these c++ file extensions? 

There is no consensus.  Some compilers use the extension to
determine whether a file is a C or C++ file (if the compiler can
compile both languages), some do not.  Some compilers accept a
variety of extensions, some are restrictive.

For C++ main (non-header) files, I have seen: .c .C .CC .c++ .cxx

For C++ header files, I have seen: .h .hxx .h++

There may be others.

Since you usually have to specify the file extension as part of the
#include directive, the header file extension is a different category
of concern from the main C++ file extension.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com

jim@tortuga.SanDiego.NCR.COM (Jim (James) Ruehlin) (06/29/91)

In article <1991Jun27.204912.8609@javelin.sim.es.com> cberrett@tau.sim.es.com (Craig Berrett) writes:
>
>There seems to be a variety of  different file extensions used to
>indicate that a
>file is a c++ source or header file .  At this time is there any
>consensus as to the
>naming convention that should be used? What is currently in use for
>these c++
>file extensions? 

In my experience, there's no consensus.  I used to use Glockenspeil and
the CommonVu libraries for MS 3.0).  These wanted .cxx and .hxx extension.
Later I moved to Borland C++ 2.0, which likes .cpp but has an option
that will take anything.  I share some code with people developing on
Unix, and they use .c and .h .   

For my own purposes I use .c and .h to make me compatible with the Unix
people.  Some of my include files are also .hxx  .     I'd like to
see some standard like .cpp and .hpp for C++, leaving .c and .h to
C so we can always tell the difference.

- Jim Ruehlin

catfood@NCoast.ORG (Mark W. Schumann) (06/30/91)

In article <786@taumet.com> steve@taumet.com (Stephen Clamage) writes:
>cberrett@tau.sim.es.com (Craig Berrett) writes:
>
>>There seems to be a variety of  different file extensions used to
>>indicate that a file is a c++ source or header file .
>>At this time is there any consensus as to the
>>naming convention that should be used? What is currently in use for
>>these c++ file extensions? 
>
>There is no consensus.  Some compilers use the extension to
>determine whether a file is a C or C++ file (if the compiler can
>compile both languages), some do not.  Some compilers accept a
>variety of extensions, some are restrictive.
>
>For C++ main (non-header) files, I have seen: .c .C .CC .c++ .cxx
>
>For C++ header files, I have seen: .h .hxx .h++
>
I like .cpp and .hpp.  Borland compilers like to see .cpp and don't
care what you use for your headers.

-- 
============================================================
Mark W. Schumann  3111 Mapledale Avenue, Cleveland 44109 USA
Domain: catfood@ncoast.org
UUCP:   ...!mailrus!usenet.ins.cwru.edu!ncoast!catfood