473,503 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

does the file extension matter how it's compiled?

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
Dec 28 '06 #1
3 1611
smnoff wrote:
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
This depends on the compiler, but since it is compiled as C++ code even
with a .c file extension -- your message is not very clear, but this is
what you appear to be saying -- apparently the file extension does not
matter for yours.

Dec 28 '06 #2
On Thu, 28 Dec 2006 16:59:29 -0600, smnoff wrote
(in article <b%*****************@newsfe19.lga>):
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

Dec 28 '06 #3
smnoff a écrit :
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

It depends on the compiler, as people have already said.
Many compilers have an option that allow to force the
type of language they will compile, when they are
multi-language compilers.

Other compilers compile just one language, so they ignore
the suffix of the source code.

Dec 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
327
by: smnoff | last post by:
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
113
5184
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
7
2235
by: The Cool Giraffe | last post by:
Please note that i do intend to use a header file. However, i'm not sure if it's really needed or just a convention. Suppose we have the following two files. // Something.h class Something {...
2
3287
by: Reggie | last post by:
Hi and TIA! I have a class file located in my root directory with all me web pages. I call/use the class and it works fine. I have no imports statements aspx or codebehind. My question is why? ...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5576
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.