Sujet : Re: C23 thoughts and opinions
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 26. May 2024, 22:16:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240526140327.709@kylheku.com>
References : 1 2 3 4 5 6 7 8 9
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-05-26, jak <
nospam@please.ty> wrote:
Keith Thompson ha scritto:
Indeed there are c++ compilers who, if used to compile c code, could
decide to call the c compiler to do the work, but if something in the
code is not strictly c, then the compilation will be in c++, the size
of the executable will increase significantly and will need of an
internal or external runtimer to work. If it were the same thing you
would not get different things.
Oh? Do you know of a C++ compiler that actually behaves this way?
I've never heard of such a thing.
For example g++ makes something similar: if you pass a file .C it
compile the C code but if the file (.C) contains C++ code then
compile C++.
1. The file suffix is not "something /in the code/ that is not strictly C".
The front end of a compiler collection selecting a compiler based
on file suffix is not an example of switching language based
on syntax in the file.
2. g++ does not behave this way.
In fact .C (capital C) is one of the conventions for C++ files. I
seem to remember that the convention was used at A&T and in fact you
can find examples of it in the source code of Cfront (the historic
C++ to C transpiler originally developed by B. Stroustrup).
For g++ to assume that a .C file is C and not C++ would be insanely
poor.
The g++ command even assumes that .c files are C++!
Conversely, when you use the gcc driver command on a .C file,
you get the C++ compiler!
Since you'r posting to Usenet, you're obviously connected to the same
Internet as the rest of us, so it's amazing you're not able to check
your facts. You know about g++, so presumbly you have an installation of
it somewhere, where you could run a 30 second experiment.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca