c++.beta - void* => Base* is convertable?bug?
- nyra (12/12) Oct 06 2003 see following code:
- Heinz Saathoff (8/22) Oct 07 2003 This should not be convertable. That's the reason why NULL should be
- Ilya Minkov (8/26) Oct 26 2003 I like it when it is possible to write NULL when i mean it instead of a
see following code: struct Base { char c; }; void test(Base* some){ std::cout<<"ok"<<std::endl; } int main(void){ test((void*)0); return 0; } void* => Base* is convertable? extract from Loki library. nyra
Oct 06 2003
nyra schrieb...see following code: struct Base { char c; }; void test(Base* some){ std::cout<<"ok"<<std::endl; } int main(void){ test((void*)0); return 0; } void* => Base* is convertable?This should not be convertable. That's the reason why NULL should be defined as #define NULL 0 instead of #define NULL (void*)0 I assume DMC allows this for backward compatibility? - Heinz
Oct 07 2003
I like it when it is possible to write NULL when i mean it instead of a stupid cast! A cast is not only more typing, it's also cluttered, hard-to-read code. It can really turn a neat function call into something. I propose that the implicit void* -> any* convertion stays. I don't even see where it could harm one. (without touching any religious issues...) -eye nyra wrote:see following code: struct Base { char c; }; void test(Base* some){ std::cout<<"ok"<<std::endl; } int main(void){ test((void*)0); return 0; } void* => Base* is convertable? extract from Loki library. nyra
Oct 26 2003