Topic: FAQ? 'Standard' filename extension for C++ source


Author: matt@physics2.berkeley.edu (Matt Austern)
Date: 21 Mar 1994 00:36:12 GMT
Raw View
In article <1846@racerx.bridge.COM> rodb@bridge.com (Rod Burman) writes:

>     I think the committee should say something in the standard
> otherwise the way things are going C++ won't be portable since
> we won't be able to call the files the same

It'll never happen, nor should it.

You can't say anything general about file extensions: not all systems
have file names that are described by base name + extensions; for that
matter, not all systems have file names in any simple sense, or even
files.  There's nothing in the C or C++ standard requiring source code
to be stored on a Unix-style file system!

What should happen is that we should all complain to compiler vendors
who sell products that make inflexible demands about file names.
--
Matthew Austern                       Never express yourself more clearly
matt@physics.berkeley.edu             than you think.    ---N. Bohr




Author: jimp@cognos.COM (Jim Patterson)
Date: Tue, 8 Mar 1994 18:44:47 GMT
Raw View
Is there a 'standard' extension for C++ files? I know (or assume) that,
like the C standard, the proposed C++ standard is likely intended for
environments where a file extension might be a foreign concept.
Nonetheless, for a lot of environments the lack of consistency
in choice of extension is a real problem. We're currently starting a
project developing under Windows, and so are leaning towards .cpp since
Microsoft says so, but I've noticed that Gnu C++ doesn't support
.cpp. We would like to converge on a widely accepted extension now,
rather than end up with a massive renaming exercise later, so I'm posing
the question.

I've seen at least five different extensions being used. GNU C++
supports .cc, .cxx or .C. Likewise Microsoft C++ supports .cpp or
.cxx. I think other compilers also support .c++. Which is best?

Obviously, depending on case distinctions (e.g. .C) is a bad idea since
many systems are case-insensitive. .c++ is likely a bad idea as well
since special characters may have special meanings in some situations or
might simply be invalid.

So, can we expect that the C++ standard currently being developed will
put forward a "standard" convention, even though it might not apply to
some environments? Or, will it wash its hands of the current mess of
conflicting conventions as being "environment dependant"?

Inquiring minds want to know (:^).

--
Jim Patterson                  Cognos Incorporated
Sr Consulting Engineer         P.O. BOX 9707
UUNET:jimp@cognos.COM          3755 Riverside Drive
PHONE:(613)738-1338 x3385      Ottawa, Ont  K1G 3Z4




Author: d91-jda@buzzcocks.nada.kth.se (Johan Danielsson)
Date: 08 Mar 1994 19:47:24 GMT
Raw View
jimp@cognos.COM (Jim Patterson) writes:

> I've seen at least five different extensions being used. GNU C++
> supports .cc, .cxx or .C. Likewise Microsoft C++ supports .cpp or
> .cxx. I think other compilers also support .c++. Which is best?

A few people even use .c

> Obviously, depending on case distinctions (e.g. .C) is a bad idea since
> many systems are case-insensitive. .c++ is likely a bad idea as well
> since special characters may have special meanings in some situations or
> might simply be invalid.

Cpp to me is the C preprocessor, and cxx is to long. For once I agree
with GNU, I use .cc.

--

| d91-jda@nada.kth.se   | Everything's cool and froody.
| Johan Danielsson      |                          -ZB