freelanceprogrammers.org Forum Index » C

how compiler make difference between C and C++


View user's profile Post To page top
nitgupta2000in Posted: Fri Dec 24, 2004 2:38 pm


Joined: 24 Dec 2004

Posts: 1
how compiler make difference between C and C++
 
Hai EveryOne
Can Anyone solve my one query is that how compiler make difference between C and C++. I tried to search on net but not got proper results.

bye bye
nitin gupta

NITIN GUPTA
Programmer
GoldenEmbryo Tech. Pvt. Ltd.
Pune
09850543113(mob.)
Reply with quote
Send private message
View user's profile Post To page top
sflam108 Posted: Fri Dec 24, 2004 11:42 pm


Joined: 25 Jul 2003

Posts: 48
how compiler make difference between C and C++
Without using any compiler options, from the file extension.

HTH
Shyan


> From: nitin gupta [mailto:tonit@...]
> Sent: Friday, December 24, 2004 2:39 AM
> To: Programmers-Town@yahoogroups.com
> Subject: (PT) how compiler make difference between C and C++
>

> Hai EveryOne
> Can Anyone solve my one query is that how compiler make difference between
> C and C++. I tried to search on net but not got proper results.
>
> bye bye
> nitin gupta
> NITIN GUPTA
> Programmer
> GoldenEmbryo Tech. Pvt. Ltd.
> Pune
> 09850543113(mob.)
Reply with quote
Send private message
View user's profile Post To page top
kith_kahnan Posted: Mon Dec 27, 2004 11:57 pm


Joined: 04 Jan 2005

Posts: 13
how compiler make difference between C and C++
>Hai EveryOne
>Can Anyone solve my one query is that how compiler make difference between
C and C++. I tried to search on net but not got >proper results.
>
>bye bye
>nitin gupta
>
>NITIN GUPTA
>Programmer
>GoldenEmbryo Tech. Pvt. Ltd.
>Pune
>09850543113(mob.)

Well, that would depend on the compiler you`re using. In MS VC++ 6, for
example, the MSCRT defines a macro, __cplusplus. If you undefine that macro,
then the compiler will treat your code as C code.

Regards,
Fernando.
Reply with quote
Send private message
View user's profile Post To page top
shabble Posted: Wed Dec 29, 2004 5:44 pm


Joined: 29 Dec 2004

Posts: 31
how compiler make difference between C and C++
From: nitin gupta [mailto:tonit@...]

>Can Anyone solve my one query is that how compiler make
>difference between C and C++. I tried to search on net but not
>got proper results.

Usual behaviour is determinted by the file extension of the file you`re
compiling, but can be overridden using a command line option (or
somewhere in Tools>Option in your IDE.)

--
PJH

"Consistently separating words by spaces became a general custom about
the tenth century A.D., and lasted until about 1957, when FORTRAN
abandoned the practice." -- Sun FORTRAN Reference Manual



Alderley plc, Arnolds Field Estate, The Downs, Wickwar, Gloucestershire, GL12
8JD, UK
Tel: +44(0)1454 294556 Fax: +44 (0)1454 299272

Website : www.alderley.com Sales : sales@... Service :
service@...

This email and its contents are confidential and are solely for the use of the
intended recipient. If you are not the original recipient you have received it
in error and any use, dissemination, forwarding, printing or copying of this
email is strictly prohibited. Should you receive this email in error please
immediately notify it@...

This email has been scanned for viruses, however you should always scan emails
with your own systems prior to opening.
Reply with quote
Send private message
View user's profile Post To page top
sflam108 Posted: Tue Jan 04, 2005 2:37 am


Joined: 25 Jul 2003

Posts: 48
how compiler make difference between C and C++
Reply embedded...

> -----Original Message-----
> From: Fernando Arturo Gómez Flores [mailto:fernando.gomez@...]
> Sent: Monday, December 27, 2004 11:57 AM
> To: Programmers-Town@yahoogroups.com
> Subject: Re: (PT) how compiler make difference between C and C++
>
>
> Well, that would depend on the compiler you`re using.

Most compilers recognized the file type by looking at the file extension.

Or you might be able to force the compiler to ignore the file type by
supplying compiler switch.


> In MS VC++ 6, for
> example, the MSCRT defines a macro, __cplusplus. If you undefine that
> macro, then the compiler will treat your code as C code.

You don`t define the __cplusplus macro. It is defined by the compiler when
compiling a C++ source.

HTH
Shyan
Reply with quote
Send private message
View user's profile Post To page top
kith_kahnan Posted: Tue Jan 04, 2005 5:14 am


Joined: 04 Jan 2005

Posts: 13
how compiler make difference between C and C++
>Reply embedded...

>> -----Original Message-----
>> From: Fernando Arturo Gómez Flores
[mailto:fernando.gomez@...]
>> Sent: Monday, December 27, 2004 11:57 AM
>> To: Programmers-Town@yahoogroups.com
>> Subject: Re: (PT) how compiler make difference between C and C++
>>
>>
>> Well, that would depend on the compiler you`re using.
>
>Most compilers recognized the file type by looking at the file extension.
>
>Or you might be able to force the compiler to ignore the file type by
>upplying compiler switch.
>
>
>> In MS VC++ 6, for
>> example, the MSCRT defines a macro, __cplusplus. If you undefine that
>> macro, then the compiler will treat your code as C code.
>
>You don`t define the __cplusplus macro. It is defined by the compiler when
>compiling a C++ source.
>
Yes, I realized that in MSVC6 there`s a switch for the compiler, /Tc, that
forces a C compilation instead of C++. That was great, I used to undefine
that macro (with C++ features still on) so that the entities (i.e. COM
interfaces) behave as C entities; or used DevC compiler rather than MSVC6.

Learn from my mistake: first read the complete documentation of your
compiler ;)

Regads,
Fernando.




To unsubscribe : programmers-town-unsubscribe@yahoogroups.com


Yahoo! Groups Links
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help