dip1000: why can't the addressee come into existence later?

2018-11-09 Thread Neia Neutuladh via Digitalmars-d-learn
The following code doesn't work with @safe -dip1000: int* p; int i; p = &i; i has a shorter lifetime than p, the compiler complains. But this code does: int i; int* p; p = &i; In both cases, p can't point to i before i exists, and p ceases to exist when i ceases to exi

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 19:40:15 UTC, Mike Parker wrote: When you link statically with a library, you have to link with all of its dependencies, too. For GLFW, you'll need User32.lib, gdi32.lib, and OpenGL32.lib, off the top of my head. Aha. Now I wonder why LDC includes those dependenci

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 19:21:30 UTC, kinke wrote: May be worth another try with the proper command line. Thank you! LDC + LD now works without warnings. On Friday, 9 November 2018 at 19:21:30 UTC, kinke wrote: Run LDC or DMD with `-v`, that gives you the linker command line at the end

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote: Both work, albeit with a lot of warnings: libcmt.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library glfw3.lib(init.c.obj) : warning LNK4217: locally defined symbo

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 November 2018 at 19:06:56 UTC, Dennis wrote: On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote: [...] I just noticed in the section about the static version: "This requires the GLFW development package be installed on your system at compile time." http://code.dlang.org/pa

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread kinke via Digitalmars-d-learn
On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote: I'm trying the static bindings for glfw of bindbc on Windows, using the pre-compiled .lib files from the lib-vc2015 folder in the official download. (http://code.dlang.org/packages/bindbc-glfw) With LDC using the Microsoft MSCV linker, e

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote: [...] I just noticed in the section about the static version: "This requires the GLFW development package be installed on your system at compile time." http://code.dlang.org/packages/bindbc-glfw I don't see where I can install the 'de

linker warnings and errors with bindbc-glfw

2018-11-09 Thread Dennis via Digitalmars-d-learn
I'm trying the static bindings for glfw of bindbc on Windows, using the pre-compiled .lib files from the lib-vc2015 folder in the official download. (http://code.dlang.org/packages/bindbc-glfw) With LDC using the Microsoft MSCV linker, everything works. I can either add this: app.d: ``` versi

Re: Why is stdio ... stdio?

2018-11-09 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 09, 2018 at 05:36:54PM +, Chris Katko via Digitalmars-d-learn wrote: [...] > FYI, Allegro.CC just uses > > > int main() > { > return 0; > } > > > as well as for pre-formatted "monospace" text. > > Neither of those would pollute a mailing list in plain-text mode > because t

Re: How do I install a library?

2018-11-09 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 09, 2018 at 05:38:18PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Friday, 9 November 2018 at 01:18:51 UTC, bachmeier wrote: > > There's no obvious reason it can't be done that way in D > > It is trivial, really. Just download the files to your import path and > `dmd -i`.

Re: Why is stdio ... stdio?

2018-11-09 Thread Chris Katko via Digitalmars-d-learn
On Friday, 9 November 2018 at 09:11:37 UTC, Jonathan M Davis wrote: On Friday, November 9, 2018 1:27:44 AM MST Kagamin via Digitalmars-d-learn wrote: On Friday, 9 November 2018 at 06:42:37 UTC, Jonathan M Davis wrote: > [...] You used markdown three times in your message. No, I didn't. I jus

Re: How do I install a library?

2018-11-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 9 November 2018 at 01:18:51 UTC, bachmeier wrote: There's no obvious reason it can't be done that way in D It is trivial, really. Just download the files to your import path and `dmd -i`. Only hard part is the modules need to be arranged such that dmd -i will find it... and the dub

Re: Is this a bug? +goto

2018-11-09 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 8 November 2018 at 09:34:34 UTC, Michelle Long wrote: What I am talking about is about an obvious error... OK, so here are your code slightly modified: void main(){ int i; W: if(i==0) goto Q; int x; Q: i++; if(i==1) goto W; writeln("a"); }

Re: How do I install a library?

2018-11-09 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 9 November 2018 at 00:18:28 UTC, H. S. Teoh wrote: It's not true that you're stuck with dub. And I'm not among the people who think dub is the way to go (though it's true that that's a minority opinion around here). Where I have a choice, my own D projects do not use dub. Me neit

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 9, 2018 5:22:27 AM MST Vinay Sajip via Digitalmars-d- learn wrote: > On Friday, 9 November 2018 at 11:24:42 UTC, Jonathan M Davis > > wrote: > > decode and decodeFront are for converting a UTF code unit to a > > Unicode code point. So, you're taking UTF-8 code unit (char), > > U

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Vinay Sajip via Digitalmars-d-learn
On Friday, 9 November 2018 at 11:24:42 UTC, Jonathan M Davis wrote: decode and decodeFront are for converting a UTF code unit to a Unicode code point. So, you're taking UTF-8 code unit (char), UTF-16 code unit (wchar), or a UTF-32 code unit (dchar) and decoding it. In the case of UTF-32, that's

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 9, 2018 3:45:49 AM MST Vinay Sajip via Digitalmars-d- learn wrote: > On Friday, 9 November 2018 at 10:26:46 UTC, Dennis wrote: > > On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote: > >> std.utf.decodeFront(Flag useReplacementDchar = > >> No.useReplacementDchar, S)(r

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 10:45:49 UTC, Vinay Sajip wrote: As I see it, a ubyte 0x20 could be decoded to an ASCII char ' ', and likewise to wchar or dchar. It doesn't (to me) make sense to decode a char to a wchar or dchar. Anyway, you've shown me how decodeFront can be used, so great! Th

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Vinay Sajip via Digitalmars-d-learn
On Friday, 9 November 2018 at 10:26:46 UTC, Dennis wrote: On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote: std.utf.decodeFront(Flag useReplacementDchar = No.useReplacementDchar, S)(ref S str) if (isInputRange!S && isSomeChar!(ElementType!S)) This is the overload you want, let's

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote: std.utf.decodeFront(Flag useReplacementDchar = No.useReplacementDchar, S)(ref S str) if (isInputRange!S && isSomeChar!(ElementType!S)) This is the overload you want, let's check if it matches: ref S str - your InputRange can be pas

Re: scoped classes and dependency inversion

2018-11-09 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Friday, 9 November 2018 at 09:17:27 UTC, Alex wrote: Is it this what you are looking for? https://dlang.org/phobos/std_traits.html#Parameters I've been looking over std.traits all day yesterday, how could I've missed that? I'm so glad there are people in this forum that want to help out othe

Using decodeFront with a generalised input range

2018-11-09 Thread Vinay Sajip via Digitalmars-d-learn
According to the std.utf documentation, decode will only work with strings and random access ranges of code units with length and slicing, whereas decodeFront will work with any input range of code units. However, I can't seem to get such a usage to compile: the following code import std.r

Re: scoped classes and dependency inversion

2018-11-09 Thread Alex via Digitalmars-d-learn
On Friday, 9 November 2018 at 09:13:56 UTC, Sjoerd Nijboer wrote: On Thursday, 8 November 2018 at 21:16:32 UTC, Sjoerd Nijboer wrote: I tried tom make a lazyscoped!T but I'm stuck at creating a constructor and determining the arguments from the Type. Unfortunately I can't find a way in D to ge

Re: scoped classes and dependency inversion

2018-11-09 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Thursday, 8 November 2018 at 21:16:32 UTC, Sjoerd Nijboer wrote: I tried tom make a lazyscoped!T but I'm stuck at creating a constructor and determining the arguments from the Type. Unfortunately I can't find a way in D to get a list of arguments at compile time for a given function. Is thi

Re: Why is stdio ... stdio?

2018-11-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 9, 2018 1:27:44 AM MST Kagamin via Digitalmars-d-learn wrote: > On Friday, 9 November 2018 at 06:42:37 UTC, Jonathan M Davis > > wrote: > > Honestly, having markdown in messages being typical would be > > _really_ annoying for those of us not using the web interface, > > becaus

Re: Why is stdio ... stdio?

2018-11-09 Thread Kagamin via Digitalmars-d-learn
On Friday, 9 November 2018 at 06:42:37 UTC, Jonathan M Davis wrote: Honestly, having markdown in messages being typical would be _really_ annoying for those of us not using the web interface, because we'd see all of those backticks and the like as backticks, not as syntax highlighting. It would