Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cxx file extension

1 view
Skip to first unread message

Francois Chartrand

unread,
Jan 21, 2005, 11:58:20 PM1/21/05
to
Hi,

I recently see people using .cxx file to develop in C++. Is there
anybody who know the difference between using a .cpp file and .cxx
file (Windows)?

Thanks

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Patrick Leslie Polzer

unread,
Jan 22, 2005, 6:22:40 AM1/22/05
to
Francois Chartrand wrote:
> Hi,
>
> I recently see people using .cxx file to develop in C++. Is there
> anybody who know the difference between using a .cpp file and .cxx
> file (Windows)?
If this is a platform-specific question, you should write to a more
appropriate newsgroup. If not, the answer is that there isn't any
difference.

Leslie

Troels Henriksen

unread,
Jan 22, 2005, 1:38:58 PM1/22/05
to
fchar...@avantas.com (Francois Chartrand) writes:

> I recently see people using .cxx file to develop in C++. Is there
> anybody who know the difference between using a .cpp file and .cxx
> file (Windows)?

There isn't really one. Some compilers refuse to compile files with an
invalid suffix (cpp, cxx, C and C are usually safe), but that's about
it. As long as you keep consistent, there shouldn't be an issue.

--
_ _
/'< Troels "Athas" Henriksen >'\
/_v/ "In void* we trust." \v_\

Dave Harris

unread,
Jan 22, 2005, 1:47:08 PM1/22/05
to
fchar...@avantas.com (Francois Chartrand) wrote (abridged):

> I recently see people using .cxx file to develop in C++. Is there
> anybody who know the difference between using a .cpp file and .cxx
> file (Windows)?

I doubt there is a difference, other than local convention.

In the olden days, there was no established convention. Some people used
"xx" because it looks a bit like "++"; they didn't want to use actual "++"
because of potential problems (eg if the local commandline shell uses +
for regular expressions). I've not seen it recently, but I daresay this
convention persists.

-- Dave Harris, Nottingham, UK

ka...@gabi-soft.fr

unread,
Jan 24, 2005, 3:41:18 PM1/24/05
to
Troels Henriksen wrote:
> fchar...@avantas.com (Francois Chartrand) writes:

> > I recently see people using .cxx file to develop in C++. Is
> > there anybody who know the difference between using a .cpp
> > file and .cxx file (Windows)?

> There isn't really one. Some compilers refuse to compile files
> with an invalid suffix (cpp, cxx, C and C are usually safe),
> but that's about it. As long as you keep consistent, there
> shouldn't be an issue.

.C is not necessarily safe. On a system where filenames are
case insensitive, the compiler will normally compiler .C as a C
file, not a C++ file.

All compilers I know of also have an option to allow explicit
specification of the language. Thus, in VC++, /Tp, or with g++,
-x c++, will ensure that the next (or following, in g++) files
will be considered C++, regardless of their extension.

--
James Kanze GABI Software http://www.gabi-soft.fr
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

John Kewley

unread,
Feb 2, 2005, 3:21:47 PM2/2/05
to
Dave Harris wrote:
> fchar...@avantas.com (Francois Chartrand) wrote (abridged):
>
>>I recently see people using .cxx file to develop in C++. Is there
>>anybody who know the difference between using a .cpp file and .cxx
>>file (Windows)?
>
>
> I doubt there is a difference, other than local convention.
>
> In the olden days, there was no established convention. Some people used
> "xx" because it looks a bit like "++"; they didn't want to use actual "++"
> because of potential problems (eg if the local commandline shell uses +
> for regular expressions). I've not seen it recently, but I daresay this
> convention persists.

Also .cpp was also sometimes used for cpp (C preprocessor).

I have always used .cxx, .hxx, .ixx, .lxx, .yxx and .txx (for C++ coded
code, header, inline, lex, yacc and template files). I used to also use
something like .rxx for input to rpcgen.

Only occasionally did a compiler not accept the .cxx.

JK

0 new messages