Liste des Groupes | Revenir à cl c |
On 2024-05-26, jak <nospam@please.ty> wrote:About what you are talking about I must apologize for one thing: in myKeith Thompson ha scritto:1. The file suffix is not "something /in the code/ that is not strictly C".For example g++ makes something similar: if you pass a file .C itIndeed 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.
>
compile the C code but if the file (.C) contains C++ code then
compile 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.
Les messages affichés proviennent d'usenet.