<br><br><div class="gmail_quote">2009/2/1 Gabriel Dos Reis <span dir="ltr"><<a href="mailto:gdr@integrable-solutions.net">gdr@integrable-solutions.net</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Sun, Feb 1, 2009 at 6:52 PM, Geo Carncross <<a href="mailto:geocar@gmail.com">geocar@gmail.com</a>> wrote:<br>
> On Sun, Feb 1, 2009 at 3:50 PM, Gabriel Dos Reis<br>
> <<a href="mailto:gdr@integrable-solutions.net">gdr@integrable-solutions.net</a>> wrote:<br>
>><br>
>>   (int)(intptr_t)file<br>
>><br>
>> since intptr_t is garanteed to be precise enough to hold<br>
>> a value of type void*.<br>
><br>
> Well, casting it to (int) [if that causes problems] would simply truncate it<br>
> again anyway- even though it was originally cast to intptr_t<br>
><br>
<br>
</div></div>In earlier conversation, Juanjo seemed to suggest that<br>
the value there really was an int. So the truncation was OK.<br>
My point in my preceding message is that the mapping<br>
from void* to int is highly unportable (anyone to guess standard<br>
semantics?), compared to the mapping from void* to intptr_t,<br>
which although implementation-defined is guaranteed to yield<br>
the original int value back.</blockquote><div><br>That's true. I couldn't find where you were talking about in c/file.d - I just saw all the FILE* packs into that file. field (and back again) and assumed it was one of those.<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
My personal inclination would be to use a union of void* and int,<br>
and select the appropriate field, thereby not depending on any<br>
implementation defined assumption at all.  That also would<br>
make the intent clearer.</blockquote><div><br>I agree, but it seems like a lot of the stdio code is getting ripped out in favor of posixish reads and writes which means it might really become an int soon :) <br></div></div>
<br>