| |
 | Posted by Jonathan M Davis | Permalink Reply |
|
Jonathan M Davis 
| On Thursday, September 06, 2012 01:52:01 Andrej Mitrovic wrote:
> Anyway I've two questions:
> 1) Has anyone come up with a library solution for a typedef because I
> need it for cases like these, and
> 2) Will c_long/c_ulong be converted to a library typedef or will they
> remain aliases?
Considering that the only reason to use c_long and its ilk is because you have an extern(C) function, I wouldn't expect Typedef to have anything to do with it, because that would be D struct. I'd always expect them to be aliases. If you really have two functions which conflict because the same size integer, then you really have two functions which conflict. I'm fairly sure that the C linker is going to see any difference between int and long either if long is the same size as int (though I could be wrong).
So, if you're trying to overload based on integral types which can change size depending on the architecture, I'd advise that you use static if so that only one of them is defined when they're the same. You shouldn't have both of them if the integral types are actually the same size, because then you have two functions with the exact same signature, regardless of what the actual names of the types are.
- Jonathan M Davis
|