size_t, size_t, wherefore art thou aliased?
Gregor Richards
Richards at codu.org
Wed Sep 20 11:28:00 PDT 2006
Lionello Lunesu wrote:
>> Unfortunately, this makes assigning values to size_t and ptrdiff_t
>> obnoxious, since it only implicitly casts one way (not the way that's
>> helpful here).
>
> typedef int test_t;
> void main(){
> test_t x = 2;
> }
>
> works just fine. Am I missing something?
>
> L.
>
>
typedef int test_t;
int main()
{
test_t x;
int y = 2;
x = y;
return 0;
}
Actually, the absolutely precise solution would be a precise reversal of
the typedef rules - size_t should accept ints/longs/etc, but
ints/longs/etc should not accept size_t.
- Gregor Richards
More information about the Digitalmars-d
mailing list