Usage of C++ NULL vs 0

B

Bo Persson

James said:
[...]
C++ is a pragmatic way of creating a powerful high level
language. It's inheritance is what made it take off.

It's its pragmatics (C compatibility, works with existing
linkers, etc.) which made it succeed. It certainly wasn't the
only (or even the first) language to propose inheritance.

I meant that its inheritance from C was a big part of its initial
success. Not inheritance as a language element...
In the last case, the language probably didn't take of because
of the funding, or the source of the funding. I know of one or
two cases where Ada wasn't considered because it was backed by a
government burocracy.

:)


Bo Persson
 
M

Matthias Buelow

James said:
The
larger the project, the more important static type checking
becomes.)

This is too simplistic, imho. The larger the project, the more highlevel
the language should be. Getting bogged down in technical detail (like
the extremely verbose, explicit C++ style of typing) is more of a threat
than lack of compile-time type safety. Generally speaking, the more
suitable a language is to describe the problem (or its solution) in a
concise, clear way, the less bugs the software will have and the less
problems will arise during maintenance. C++ has some provisions here,
for example STL containers and algorithms vs. C-style pointer juggling
but in other parts it is completely off the trail.
 
M

Matthias Buelow

James said:
The last thing you want is for
existing client code to compile without change; you want to be
forced to look at that code, to ensure that it will still work
with the new contract.

Wrong, this is _exactly_ the thing I want to have. If I make a local
change, including changing return types or parameters, the least thing I
want to do is having to go to all call places and change call/value
semantics there aswell. This is just tedious and annoying and
discourages quick and frequent changes, which are essential for a
"malleable" development process. I mean, it's bad (and silly) enough
that I have to recompile all call places when I make such a change.
 
I

Ian Collins

Francis said:
Yes, but C and C++ are schizophrenic: file-scope and static local
variables are implicitly initialized to all-bits-zero, but automatic
variables are not.

IMHO, not initializing automatic variables is premature optimization.
Yes, those cycles may have been precious in 1971, but today spending a
few CPU cycles to initialize an automatic variable worth saving the far
more valuable minutes or hours of human time needed to track down the
bug (not to mention potentially avoiding customer exposure to the bug).

Yes but if you declare and initialise our variables when we need them,
you don't have a problem.
 

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

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,197
Latest member
ScottChare

Latest Threads

Top