std.stdio.tmpfile() return shared(_IO_FILE)* and not File

simendsjo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 24 11:29:14 PDT 2014


On 08/24/2014 08:09 PM, anonymous wrote:
> On Sunday, 24 August 2014 at 17:55:05 UTC, simendsjo wrote:
>> Using DMD 2.066 on GNU/Linux x86_64.
>>
>> This is strange:
>>
>> import std.stdio;
>> void main() {
>>     auto f = tmpfile();
>>     pragma(msg, typeof(f)); // shared(_IO_FILE)*
>> }
>>
>> But stdio.d looks like the following:
>>     static File tmpfile() @safe
>>
>> What is going on here?
> 
> You're calling `core.stdc.stdio.tmpfile`. There is no
> `std.stdio.tmpfile`, it's `std.stdio.File.tmpfile`.

Thanks.

So std.stdio.tmpfile() returns shared(_IO_FILE)* and
std.stdio.File.tmpfile() returns File.

Talk about confusing. If I want something from pure C libraries, I would
use core.stdc.


More information about the Digitalmars-d-learn mailing list