Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Mar 2002 16:31:02 +0100
From:      Raymond Wiker <Raymond.Wiker@fast.no>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        Terry Lambert <tlambert2@mindspring.com>, "Steve B." <steveb99@earthlink.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: C vs C++
Message-ID:  <15494.13878.219807.949085@raw.grenland.fast.no>
In-Reply-To: <20020306032029.GA7926@hades.hell.gr>
References:  <20020305132457.A4700-100000@alpha.yumyumyum.org> <001701c1c481$d0d5eab0$f642d9cf@DROID> <20020305231252.GC5328@hades.hell.gr> <3C8568E0.76415D99@mindspring.com> <20020306032029.GA7926@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
Giorgos Keramidas writes:
 > On 2002-03-05 16:54, Terry Lambert wrote:
 > > Giorgos Keramidas wrote:
 > > > The steeper learning curve of C++ is indeed steeper, not because of
 > > > some magic property of the object-oriented programming paradigm, but
 > > > because there are a lot more things to learn, before a complete
 > > > program can be written, IMHO.
 > > 
 > > Uh... "Hello World" looks the same in ANSI C and C++, unless
 > > you insist on using I/O streams and "cout", which no one ever
 > > really does, unless they are writing a C++ book or trying to
 > > impress a student.
 > 
 > Well, to be frank, I've seen a few C++ coding style documents, that suggest
 > avoiding <stdout.h> altogether when writing in C++.  The fact that parts of
 > the C++ libraries already use the I/O stream classes, which have their own
 > buffers, combined with the buffered I/O that <stdout.h> does by default,
 > can and usually does result in all hell being let loose.

        I assume you mean <stdio.h>?

        Anyway, I *really* can't see any reason not to use <iostream>,
<fstream>, <sstream> and friends. I also cannot see any reason not to
use exceptions, the standard containers, the string classes etc.

        Used properly, these make it possible to write code that is
inherently safer than anything built around printf/scanf, char *,
longjump, etc. Without these (and a few others) you may just as well
stay with standard C.

        Then again, if you want to do object-oriented programming, C++
is probably not the right choice. If you want to use several different
paradigms simulataneously in one language, C++ may be a better fit -
although Common Lisp is a much better choice :-)

        //Raymond.

-- 
Raymond Wiker                        Mail:  Raymond.Wiker@fast.no
Senior Software Engineer             Web:   http://www.fast.no/
Fast Search & Transfer ASA           Phone: +47 23 01 11 60
P.O. Box 1677 Vika                   Fax:   +47 35 54 87 99
NO-0120 Oslo, NORWAY                 Mob:   +47 48 01 11 60

Try FAST Search: http://alltheweb.com/


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?15494.13878.219807.949085>