copying Vector elements into Dynamic Array

J

James Kanze

[...]
The reason I say the implicit conversion is arguably more important is
because it's what makes it reasonable to define NULL as a pointer to
void rather than an int. IOW, the one is more or less a consequence of
the other.

Reread that, and please explain why it is more reasonable to
define a "null POINTER constant" as an int than as a pointer
(regardless of type). Implicit conversion (other than the null
pointer conversion) are irrelevant, because we're talking about
a special case, where compiler magic is involved.

The only thing one can really conclude is that none of this is
reasonable, and that we really need a real null pointer type
(for which there is a proposal, so we might actually get it in
the next version of the standard).
 
J

Jerry Coffin

[...]
The reason I say the implicit conversion is arguably more important is
because it's what makes it reasonable to define NULL as a pointer to
void rather than an int. IOW, the one is more or less a consequence of
the other.

Reread that, and please explain why it is more reasonable to
define a "null POINTER constant" as an int than as a pointer
(regardless of type).

That's not what I meant -- I meant that (in C) you can define NULL as a
pointer to void. In C++, such a definition would be essentially unusable
because you'd have to explicitly cast it every time you mixed it with a
pointer to any other type (i.e. constantly).

[ ... ]
The only thing one can really conclude is that none of this is
reasonable, and that we really need a real null pointer type
(for which there is a proposal, so we might actually get it in
the next version of the standard).

I have no problem with that at all -- quite the contrary, I hope it
makes it into the standard. I think it's a good and useful addition to
the language. The implicit conversion from int to pointer causes quite a
few problems, and while I suppose it can't be eliminated immediately,
adding a usable replacement seems like a good first step toward doing
so.
 

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
474,291
Messages
2,571,455
Members
48,132
Latest member
KatlynC08

Latest Threads

Top