need clarification: will typedef, C struct initialization, etc.

Lionello Lunesu lio at lunesu.remove.com
Tue Jun 1 07:02:28 PDT 2010


On 1-6-2010 18:04, Kagamin wrote:
> Leandro Lucarella Wrote:
> 
>> I think he talks about this difference:
>>
>> alias int a1;
>> alias int a2;
>> typedef int t1;
>> typedef int t2;
>>
>> void fa(a2 a) {}
>> void ft(t2 t) {}
>>
>> void main() {
>> 	a1 a = 5;
>> 	fa(a); // <--- compiles fine
>> 	t1 t = 10;
>> 	ft(t); // <--- error
>> }
> windows handles are not orthogonal, they're polymorphic. For example, CloseHandle function accepts almost any handle.

OK, so I can pass any handle to CloseHandle, but that doesn't mean I can
pass any handle like any other handle. And not all typedefs in the
Windows headers behave that way, some are not compatible with anything else.

Don't focus too much on my Windows header example. It was just that, an
example.

L.


More information about the Digitalmars-d mailing list