Re: Is necessary to switch to C++ or some object-oriented language?
- From: "J. J. Farrell" <jjf@xxxxxxxxxx>
- Date: 23 Mar 2007 00:06:20 -0700
On Mar 22, 5:02 pm, "user923005" <dcor...@xxxxxxxxx> wrote:
On Mar 22, 4:35 pm, "J. J. Farrell" <j...@xxxxxxxxxx> wrote:
On Mar 22, 11:48 am, "user923005" <dcor...@xxxxxxxxx> wrote:
On Mar 21, 7:16 pm, "J. J. Farrell" <j...@xxxxxxxxxx> wrote:
On Mar 21, 2:14 pm, "user923005" <dcor...@xxxxxxxxx> wrote:
On Mar 21, 1:38 pm, rpbg...@xxxxxxxxx (Roland Pibinger) wrote:
Syntactically, C is a subset of C++ with minor exceptions. This fact
was the main reason for C++'s initial success.
Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.
I suppose it hinges on what you consider "minor", but please specify
why you consider this claim to be false. It's very rare for programs
to need to call main() recursively, or to care about the type of a
charater constant, for example. The need to cast void * to other
object pointer types is slightly more intrusive, but I'd still
consider it minor. Which are the non-minor exceptions?
Take this tarball:http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fsource%2...
Which is the PostgreSQL database (written in the C language).
Rename all of the .c files to .cpp and try to compile it.
Basically none of the files will compile.
I don't see how that's relevant to the question. If the minor
exceptions are widely used, there'll obviously be problems compiling
Many of the problems are related to keywords.
Some of the problems are caused by the new casting rules (the C style
casts are no longer acceptable in certain cases).
There are various other differences pointed out in the document
appearing elsethread from AT&T.
Whatever the reasons are, the code bases have diverged. To me,
language differences are not minor if code cannot even be compiled
without rewriting it.
The changes from C to C++ are more drastic than from Fortran IV to
Fortran95.
I suppose that each and every difference between C and C++ could be
considered minor differences. But if those differences mean that a
major rewrite is necessary to compile, then *I* consider them to be
major differences. I guess by major I was thinking in terms of things
like "It would cost over one million dollars to convert PostgreSQL
from C into C++"
It is true that there is a subset of C that will compile and run as
C++. But programs in real life are almost never members of that set.
Agreed on all counts - different interpretations of "minor". The list
of differences is small, and each of them is minor. It is possible to
turn valid C code into valid C++ code with a few minor modifications;
that is, it is incredibly unlikely to need any redesign, almost all
the changes would be little more than editorial, and there usually
wouldn't be that many of them. That doesn't mean that C code can be
compiled as C++ code, or that it's a minor job to take a real-world C
program and do the minimal work required to make it a valid C++
program.
.
- Follow-Ups:
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: Ian Collins
- Re: Is necessary to switch to C++ or some object-oriented language?
- References:
- Is necessary to switch to C++ or some object-oriented language?
- From: ajba74
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: arnuld
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: Roland Pibinger
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: user923005
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: J. J. Farrell
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: user923005
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: J. J. Farrell
- Re: Is necessary to switch to C++ or some object-oriented language?
- From: user923005
- Is necessary to switch to C++ or some object-oriented language?
- Prev by Date: Re: strdup
- Next by Date: Re: Is necessary to switch to C++ or some object-oriented language?
- Previous by thread: Re: Is necessary to switch to C++ or some object-oriented language?
- Next by thread: Re: Is necessary to switch to C++ or some object-oriented language?
- Index(es):
Relevant Pages
|
|