mixed c / c++ files

V

Vu Pham

I have a project that has at least one c++ file and some other c files.

Could you please advice which one is better ( in performance ) ?

1. Convert all c files to c++ file by renaming the extension, undeclaring
the extern "C" , and code is unchanged.

2. Put as much code as possible to c files and have mixed c/++ files.

Thanks for your advice,

Vu
 
R

Rolf Magnus

Vu said:
I have a project that has at least one c++ file and some other c
files.

Could you please advice which one is better ( in performance ) ?

1. Convert all c files to c++ file by renaming the extension,
undeclaring the extern "C" , and code is unchanged.

2. Put as much code as possible to c files and have mixed c/++ files.

I don't see why this should have anything to do with performance.
 
V

Vu Pham

Rolf Magnus said:
I don't see why this should have anything to do with performance.

Sorry for my ignorance. Is there any difference ( in performace ) between c
and c++ ?

Vu
 
J

John Harrison

Vu Pham said:
Sorry for my ignorance. Is there any difference ( in performace ) between c
and c++ ?

It depends on the compiler, and the code being compiled. Maybe C is faster,
maybe not. Any difference will be so small, that almost probably you should
be thinking about which will mean less work (now and in the future) not
which is faster.

Also bear in mind that not all C code will work the same when compiled as
C++ (some C code won't compile at all as C++), so I would say choose the
option that means the fewest changes. Why can't you just leave everything as
it is?

john
 
V

Vu Pham

----- Original Message -----
From: "John Harrison" <[email protected]>
Newsgroups: comp.lang.c++
Sent: Tuesday, May 11, 2004 10:51 AM
Subject: Re: mixed c / c++ files

It depends on the compiler, and the code being compiled. Maybe C is faster,
maybe not. Any difference will be so small, that almost probably you should
be thinking about which will mean less work (now and in the future) not
which is faster.


Thanks. That's what I need to know.
Also bear in mind that not all C code will work the same when compiled as
C++ (some C code won't compile at all as C++), so I would say choose the
option that means the fewest changes. Why can't you just leave everything as
it is?


Oh yes, I can :)

Thanks,

Vu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,458
Latest member
Chris#

Latest Threads

Top