473,654 Members | 3,115 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 1621
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
5254
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 the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
7
2244
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 { private: int number; public: Something ();
2
3305
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? I thought the class file had to be compiled and placed in the bin directory or added to the App_Code(as a class file) folder. I don't have it in either it's simply in the root. Now When I compile it and place the dll in the bin and remove the...
0
8376
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8708
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8594
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1596
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.