digitalmars.D.learn - std.stdio.tmpfile() return shared(_IO_FILE)* and not File
- simendsjo (10/10) Aug 24 2014 Using DMD 2.066 on GNU/Linux x86_64.
- simendsjo (3/18) Aug 24 2014 Oh, and ldc 0.14 and gdc 4.9.1 has the same result, so it's not a
- anonymous (3/13) Aug 24 2014 You're calling `core.stdc.stdio.tmpfile`. There is no
- simendsjo (6/24) Aug 24 2014 Thanks.
- ketmar via Digitalmars-d-learn (5/7) Aug 24 2014 On Sun, 24 Aug 2014 20:29:14 +0200
- ketmar via Digitalmars-d-learn (9/10) Aug 24 2014 On Sun, 24 Aug 2014 19:56:24 +0200
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?
Aug 24 2014
On 08/24/2014 07:56 PM, 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?Oh, and ldc 0.14 and gdc 4.9.1 has the same result, so it's not a backend thing at least.
Aug 24 2014
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`.
Aug 24 2014
On 08/24/2014 08:09 PM, anonymous wrote:On Sunday, 24 August 2014 at 17:55:05 UTC, simendsjo wrote: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.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`.
Aug 24 2014
On Sun, 24 Aug 2014 20:29:14 +0200 simendsjo via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:Talk about confusing. If I want something from pure C libraries, I would use core.stdc.dunno why std.stdio does this public import. i see no sense in it, but maybe someone with more expirience knows the answer.
Aug 24 2014
On Sun, 24 Aug 2014 19:56:24 +0200 simendsjo via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:What is going on here?std.stdio does this: 'public import core.stdc.stdio'. and in core.stdc.stdio we can find this: trusted FILE* tmpfile(); and FILE as an alias for shared(_IO_FILE), declared in 'core.stdc.stdio' too. to get 'File', call 'File.tmpfile()'.
Aug 24 2014