Thread overview
void* => Base* is convertable?bug?
Oct 06, 2003
nyra
Oct 07, 2003
Heinz Saathoff
Oct 27, 2003
Ilya Minkov
October 06, 2003
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
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
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