James Kanze
10/25/2008 8:41:00 AM
On Oct 24, 11:43 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
> Maxim Yegorushkin wrote:
> > Some actually consider C++ to be worse than C
> In my personal opinion those are delusional prejudiced people
> who suffer from a huge resistance of change. The claim is
> completely ridiculous for two reasons:
> 1) Anything you can do in C, you can do in C++.
That's not true:
int
main()
{
someFunction( 42 ) ;
return 0 ;
}
is a perfectly legal C program (supposing someFunction defined
in some other translation unit), but not a legal C++ function.
Among the things that you can do in C, but not in C++, are:
-- not declare external functions, then call them with the
wrong number or type of arguments,
-- assign a void* to a typed pointer, regardless of type, with
no explicit conversion to warn you that something extremely
dangerous is going on.
There are probably others, but these two come immediately to
mind.
Whether these possibilities can in any possible way be
considered an improvement, I leave to the judgement of the
reader.
In C99, there are a couple of more things you can do, like
VLA's and designated initializers. But since most of the people
who prefer C over C++ also reject C99, I'll not go into those.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34