K
Kufa
Hi,
I have a class String which implements the const char*() operator. I
was doing some tests today and did something like:
String test( "hello world" );
printf( "%s\n", test ); // instead of test.c_str(); or (const
char*)test
This code compiled and worked fine on a x86/visual studio 7.1. On some
other platforms, gcc was giving errors, as i would expect.
So i'm wondering if visual studio is allowing something which is
forbidden by the standard, or is there a way to force a default
conversion operator to be called when an object instance is passed to
an ellipsis?
Thanks,
/d
I have a class String which implements the const char*() operator. I
was doing some tests today and did something like:
String test( "hello world" );
printf( "%s\n", test ); // instead of test.c_str(); or (const
char*)test
This code compiled and worked fine on a x86/visual studio 7.1. On some
other platforms, gcc was giving errors, as i would expect.
So i'm wondering if visual studio is allowing something which is
forbidden by the standard, or is there a way to force a default
conversion operator to be called when an object instance is passed to
an ellipsis?
Thanks,
/d