Re: does the file extension matter how it's compiled?



On Thu, 28 Dec 2006 16:59:29 -0600, smnoff wrote
(in article <b%Xkh.30307$Rj.9167@xxxxxxxxxxxx>):

I have a file, say test.c and I want to compile is and I happen to look and
it appears to be compiled like a C++ file.
So does it matter is the file extension where to written as test.cpp

I'm not sure I understand your question, but my guess is you want to
know if source code will be compiled differently based upon the
filename being changed from test.c -> test.cpp (or vice versa).

Several compilers I've used on various platforms will change their
compilation behavior based upon that. Source files with a .cpp
"extension" in those environments will compile as if the code is C++,
even if that is not your original intent.

IIRC there is nothing in the C standard that describes that behavior.


--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





.



Relevant Pages

  • Re: Looking for Tetris
    ... A similar great effort of disassembling TURBO PASCAL was doing it for the ... converted from assembler source by hand. ... Since I am more or less specialised in compilers, I, of course, ... wondered about recreating the source code of TP3. ...
    (comp.os.cpm)
  • Re: GOBACK (was: Perform Thru/Go to vs. Perform - Compile Speed
    ... >>desks do not use compilers. ... So what exactly do 'statistics' about empty desks with no source code ... or agency, or one that does bias, to show your assertion is wrong. ...
    (comp.lang.cobol)
  • Re: hiding cgi
    ... > my company has a software that it runs on our internal servers. ... > but off of their own internals network. ... It's not obvious why you don't want them to see your source code. ... There are many compilers for many languages. ...
    (comp.os.linux.development.apps)
  • Re: whose cc recognises byte moves
    ... complement machines agree over what left shifting a 1 into the sign ... Some compilers reward deferring the promotion to long e.g. ... Do we have a practical way to establish whether or not the source code ... space and plainly correct machine code, ...
    (comp.arch.embedded)
  • Re: "Too many continuation lines" error message (no solution, just comment)
    ... >>In C, which allows recursion, automatic variables must be ... Some of those might be written using the back end of C compilers. ... the source code documentation was mostly keyed to ... (in the days of impact printers where that worked). ...
    (comp.lang.fortran)