using a typedefed variable with library classes
    Christopher Wright 
    dhasenan at gmail.com
       
    Sun Jan 18 06:44:54 PST 2009
    
    
  
Christopher Wright wrote:
> It's an implicit narrowing conversion -- that involves data loss. This 
> is a bug.
Actually, you said you had two methods, something like this:
void foo (byte i) {}
void foo (long i) {}
void main ()
{
     int a = 1;
     foo (a);
     byte b = a; // no casts
}
This example doesn't use typedefs but still complains about overloads. I 
find it odd that you can implicitly cast an arithmetic type of one width 
to another of a smaller width. I'm making a feature enhancement request 
for this.
    
    
More information about the Digitalmars-d-learn
mailing list