Thread overview | |||||
---|---|---|---|---|---|
|
October 06, 2003 void* => Base* is convertable?bug? | ||||
---|---|---|---|---|
| ||||
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 |
October 07, 2003 Re: void* => Base* is convertable?bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to nyra | 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 |
October 27, 2003 Re: void* => Base* is convertable?bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to nyra | 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
|
Copyright © 1999-2021 by the D Language Foundation