Re: Query for -dip1000
On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via Digitalmars-d- learn wrote: > Is there a way to query if the -dip1000 flag has been passed to > the compiler? I need it for enabling certain DIP-1000 escape > analysis tests only when -dip1000 has been passed. > > For instance > > static assert(!__traits(compiles, { > char[] f() > { > char[2] x; > return x[].splitterASCII!(_ => _ == ' > ').front; > } > })); > > at > > https://github.com/nordlow/phobos-next/blob/bd2fe42978aab2313977042c858d77 > c5766538e8/src/splitter_ex.d#L110 > > Or do I have to write a trait myself? A quick grep of Phobos shows a version(DIP1000) block in std/typecons.d, which appears to be used to make it so that a particular unittest block is only compiled in when -dip1000 is used, so it looks like there's a version identifier for it. - Jonathan M Davis
Re: Query for -dip1000
On Monday, 11 February 2019 at 09:29:13 UTC, Jonathan M Davis wrote: On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via Digitalmars-d- learn wrote: [...] A quick grep of Phobos shows a version(DIP1000) block in std/typecons.d, which appears to be used to make it so that a particular unittest block is only compiled in when -dip1000 is used, so it looks like there's a version identifier for it. - Jonathan M Davis That one has been added manually: https://github.com/dlang/phobos/blob/master/dip1000.mak The detection would have been better...
Re: Query for -dip1000
On Monday, February 11, 2019 3:23:25 AM MST Seb via Digitalmars-d-learn wrote: > On Monday, 11 February 2019 at 09:29:13 UTC, Jonathan M Davis > > wrote: > > On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via > > > > Digitalmars-d- learn wrote: > >> [...] > > > > A quick grep of Phobos shows a version(DIP1000) block in > > std/typecons.d, which appears to be used to make it so that a > > particular unittest block is only compiled in when -dip1000 is > > used, so it looks like there's a version identifier for it. > > > > - Jonathan M Davis > > That one has been added manually: > > https://github.com/dlang/phobos/blob/master/dip1000.mak > > The detection would have been better... Honestly, having an explicit version is far better than trying to detect it in an ad-hoc manner. It's actually guaranteed to be right in that case, whereas ad-hoc tests are more likely to have problems - especially if they're around for a while, and things change that weren't anticipated when the code was written. So, I'd actually argue that manually setting it as part of the build was a better idea than trying to detect it, but if it's manually set as part of the build instead of being built into the compiler, then it doesn't help anyone else. Though honestly, it seems to me that having version identifiers for transitional compiler flags like that is probably a good idea, since it makes transitioning code easier. The best that we can do otherwise is generally using __VERSION__, and that only works once the change is the default. - Jonathan M Davis
Re: Query for -dip1000
On Sunday, 10 February 2019 at 20:04:29 UTC, Per Nordlöw wrote: Is there a way to query if the -dip1000 flag has been passed to the compiler? I need it for enabling certain DIP-1000 escape analysis tests only when -dip1000 has been passed. For instance static assert(!__traits(compiles, { char[] f() { char[2] x; return x[].splitterASCII!(_ => _ == ' ').front; } })); at https://github.com/nordlow/phobos-next/blob/bd2fe42978aab2313977042c858d77c5766538e8/src/splitter_ex.d#L110 Or do I have to write a trait myself? https://issues.dlang.org/show_bug.cgi?id=19669
Re: Easiest way to display images
On Sunday, 10 February 2019 at 21:26:56 UTC, Adam D. Ruppe wrote: On Sunday, 10 February 2019 at 18:42:59 UTC, Murilo wrote: Adam, is there a place where we can chat? I don't like chatting via this forum. I would like to talk to you about your modules and about the D lang. get on the freenode irc, i am in #d like all the time (and will see messages when i am back on my computer) or you can dm me adam_d_ruppe there if i am online Hi Adam. I have been using your arsd library and I have noticed that compiling with -m64 causes this error: Error: cannot mix core.std.stdlib.alloca() and exception handling in _D4arsd4jpeg27detect_jpeg_image_from_fileFAxaJiJiJiZb() May I know why that happens? How can I bypass it?
Re: Easiest way to display images
On Tuesday, 12 February 2019 at 01:16:21 UTC, Murilo wrote: Hi Adam. I have been using your arsd library and I have noticed that compiling with -m64 causes this error: huh, only on 64 bit windows. well, pushed a fix up, try the new version
Re: Easiest way to display images
On Tuesday, 12 February 2019 at 01:31:48 UTC, Adam D. Ruppe wrote: On Tuesday, 12 February 2019 at 01:16:21 UTC, Murilo wrote: Hi Adam. I have been using your arsd library and I have noticed that compiling with -m64 causes this error: huh, only on 64 bit windows. well, pushed a fix up, try the new version Hi, unfortunately the problem persists. I have sent you an e-mail on your destructiona...@gmail.com account. I would prefer to talk there rather than here. I would just like to understand what is causing the problem so I can figure out a bypass.
Re: Easiest way to display images
On Tuesday, 12 February 2019 at 01:31:48 UTC, Adam D. Ruppe wrote: On Tuesday, 12 February 2019 at 01:16:21 UTC, Murilo wrote: Hi Adam. I have been using your arsd library and I have noticed that compiling with -m64 causes this error: huh, only on 64 bit windows. well, pushed a fix up, try the new version Forget about it, I just fixed it myself. :) I am so happy, I did not think I would be able to do it on my own, I guess all those years of studying were worth the effort, I read the error message and figured it was something wrong in the module jpeg.d so I opened it, read the code(in a very fast manner) and discovered that the calls to core.stdc.stdlib.alloca() were causing the problem apart from being unnecessary so I just commented all of them out(just like you did with the very first instance) and then there was a problem with the buffer variable which was only defined by you in the first instance so I just defined it in the other instances following the same method you used and it all worked in the end. I will submit a pull request on your GitHub page. Cheers.