On 2015-10-09 11:51, René J.V. Bertin wrote: > On Friday October 09 2015 13:58:37 Pocheptsov Timur wrote: >> And yes, void * in C++ can be indeed considered generic, because >> you can do this: >> >> int * p = ... void * pv = p; > > Coming from C I have some trouble with that concept of generic > pointer. Once you're used that it implies not only "can be assigned > to any type of pointer" but also "can be assigned any type of > pointer" it's not so easy to remember which of the 2 properties has > been dropped. I don't see any evident reason why in the above example > it should be possible to assign p to pv without an explicit cast, but > not the other way round.
For similar reason as: struct A {...}; struct B : A {...}; B* b = ...; A* a = b; // okay B* also_b = a; // error That is, 'void' is somewhat like a base class of everything (even POD types), so an implicit upcast is allowed as always, but also as usual, not an implicit downcast. -- Matthew _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development