Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Mar 2002 15:55:31 +0100
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        "Eugene L. Vorokov" <vel@bugz.infotecs.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: C vs C++
Message-ID:  <20020305145531.GA73995@student.uu.se>
In-Reply-To: <200203051407.g25E7Cd67446@bugz.infotecs.ru>
References:  <200203051407.g25E7Cd67446@bugz.infotecs.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 05, 2002 at 05:07:12PM +0300, Eugene L. Vorokov wrote:
> Hello,
> 
> I have a small problem. I work for software development company and
> write daemons and console tools for Unix. My boss wants everything
> to be written in C++, because he thinks C++ is cool. I prefer C
> for such tasks, but I cannot really put good arguments of why and
> where C++ can be worse than C. I know many of you prefer C too.
> Can you please explain some disadvantages of C++ comparing to C ?
> Is it slower, does it produce less effective code, why is it like
> that, etc ... or please direct me to some articles where this can
> be explained.


Properly used there are not really any disadvantages of C++ over C.
Since C is (almost) a subset of C++, most C programs will work just the
same when compiled as C++.

Proper use of the various extra features of C++ can make programs
easier to write and make them more maintainable but this requires that
the programmer actually know how to use them.

The main difference between C++ and C is the support for
object-oriented programming.  One can of course write in an
object-oriented manner in almost any programming language, including C,
but it is easier in languages that has direct support for it, like C++.

Now, not all problems are well-suited for being solved with an
object-oriented approach so in those cases the extra features of C++
won't be of much help.

I suspect that for the type programs you are writing using C++ wouldn't
really have any advantage over C, but it won't have any disadvantage
either. 

Does your boss insist on you actually writing your programs in
idiomatic C++ or would he be satisfied if you wrote them using a subset
of C++ which is very close to C.  (if the latter your programs would
still look almost the same as before, while technically being written
in C++.)

Using something just because 'it is cool' is just about the worst
reason there is of doing anything (closely followed by 'we have always
done it this way' which seems to be your reason :-) .)

> 
> I apologize for the offtopic whenever it happens, but this issue
> really pisses me off now.




-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020305145531.GA73995>