[comp.lang.c++] C++ filename convention

jsulliva@cvbnet.UUCP (Jeff Sullivan, x4096 MS 4-2) (01/10/90)

  Is there a definitive filename convention in C++?
  Zortech uses .cpp and .hpp, while others use .cxx
  and .hxx. Still, others use the C naming convention
  of .c and .h. The former methods are much better for
  development in a C/C++ environment; since makefiles
  are much more easier to maintain.
  Which is correct?

  Thanks,
  -Jeff

dee@XAIT.Xerox.COM (Donald Eastlake) (01/11/90)

And Apple's MPW C++ for the Macintosh used .cp
-- 
	+1 617-969-9570		Donald E. Eastlake, III
	ARPA: dee@XAIT.Xerox.COM    usenet:  {cbosg,decvax,linus}!cca!dee
	AppleLink:  D2002	Box N, MIT Branch PO, Cambridge, MA 02139 USA

kempf@tci.bell-atl.com (Cory Kempf) (01/11/90)

jsulliva@cvbnet.UUCP (Jeff Sullivan, x4096 MS 4-2) writes:
>  Is there a definitive filename convention in C++?
[several different conventions deleted]
>  Which is correct?

As near as I can tell, there is no convention as yet.  At least not an
accepted one.  I generally prefer to use .cc and .hh for C++ specific
files, and the traditional .c and .h for files that can be used with C
or C++.  I think you will find that there are as many different
conventions as there are compiler/developers  (well, probably not that
many, but ...)

+C

-- 
Cory Kempf		Technology Concepts	     phone: (508) 443-7311 x341
uucp:	{anywhere}!uunet!tci!kempf, kempf@tci.bell-atl.com
DISCLAIMER: TCI is not responsible for my opinions, nor I for theirs

comeau@utoday.UUCP (Greg Comeau) (01/12/90)

In article <335@cvbnet.Prime.COM> jsulliva@cvbnet.UUCP (Jeff Sullivan, x4096 MS 4-2) writes:
>filename convention in C++?..  .cpp and .hpp, .cxx  and .hxx, .c and .h.
>  Which is correct?

All are and none are.  It confusing but it's up to the implementation....

-- 
Greg, Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
Producers of CC C++, SysAdm columnist for UNIX Today!, Microsoft Systems Journal
(C programming), + others. Also, BIX c.language & c.plus.plus conf. moderator.
Here:attmail!csanta!greg / BIX:comeau / CIS:72331, 3421 / voice:718-849-2355

landauer@morocco.Sun.COM (Doug Landauer) (01/12/90)

>   Is there a definitive filename convention in C++?

No.

>   Zortech uses .cpp and .hpp, while others use .cxx
>   and .hxx. Still, others use the C naming convention
>   of .c and .h.
	
	Zortech		.cpp	.hpp
	???		.c++	.h++
	Glockenspiel	.cxx	.hxx
	AT&T		.c	.h
	AT&T		.C	.h
	G++		.cc	.h
	Sun C++		allows any of the above, but 
			prefers .cc and .h

>   Which is correct?

Depends on which compiler/translator you use.  There is no consensus.
There are problems with all of them:
	
 .cpp	"cpp" is the traditional Unix name for the C preprocessor
 .c++	not always a valid filename (e.g. on some non-Unix systems)
 .cxx	too hard to type
 .c	bad for makefiles and other tools (e.g. Sun's NSE)
 .C	not always different from .c (e.g. on many non-Unix systems)
 .cc	Concurrent C 

I personally prefer .cc, since its problem seems to be the easiest to
live with, especially for the vast majority of C++ users out there,
who (as far as I can tell) have no intention of ever using Concurrent C.
--
--    (These are my opinions; they may or may not match those of Sun.)
--
Doug Landauer -- Sun Microsystems, Inc. -- SPD, SET, Languages
landauer@eng.sun.com or ...!sun!landauer      "Think Globally -- Shop locally!"

bright@Data-IO.COM (Walter Bright) (01/13/90)

In article <335@cvbnet.Prime.COM> jsulliva@cvbnet.UUCP (Jeff Sullivan, x4096 MS 4-2) writes:
<  Is there a definitive filename convention in C++?
<  Which is correct?
None. I've seen:
	.C		useless on case-insensitive filesystems
	.c,.h		useless for makefiles
	.cpp,.hpp	sounds good to me :-)
	.cxx,.hxx	I don't like it because xx looks like wildcards to
			me, not the tilted + it's supposed to be
	.cc		no opinion