Re: alias and __VERSION__ condition doesn't play well

2022-01-18 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote: At the very top of my module I have this declaration: ```d static if (__VERSION__ >= 2098) { alias Foo = TypeA; } else { alias Foo = TypeB; } ``` No problem inside the module itself but this doesn't work when imported from

Re: alias and __VERSION__ condition doesn't play well

2022-01-18 Thread vit via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 12:05:38 UTC, Paul Backus wrote: On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote: At the very top of my module I have this declaration: ```d static if (__VERSION__ >= 2098) { alias Foo = TypeA; } else { alias Foo = TypeB; } ``` No problem inside

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 18, 2022 at 05:20:04PM +, Anonymouse via Digitalmars-d-learn wrote: > On Tuesday, 18 January 2022 at 16:43:52 UTC, H. S. Teoh wrote: > > What's the dustmite command you used? In such cases, it's useful to > > check for this specific error message in your dustmite command, so > >

Re: number ranges

2022-01-18 Thread Tejas via Digitalmars-d-learn
On Monday, 17 January 2022 at 22:48:17 UTC, H. S. Teoh wrote: On Mon, Jan 17, 2022 at 10:35:30PM +, forkit via Digitalmars-d-learn wrote: On Monday, 17 January 2022 at 22:28:10 UTC, H. S. Teoh wrote: > [...] [...] If I were able to write a compiler, my compiler would warn you: "This is

ldc2 failed with exit code -1073741819.

2022-01-18 Thread Anonymouse via Digitalmars-d-learn
I did a big sweep through my project and changed all `writefln`s and `format`s and the such to take their format patterns as compile-time parameters, and now ldc can no longer build it on Windows. It works on linux, and dmd has no problems with it. There is no error message beyond "failed

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 16:43:52 UTC, H. S. Teoh wrote: What's the dustmite command you used? In such cases, it's useful to check for this specific error message in your dustmite command, so that it doesn't reduce it past the actual problem case. T Yes, but the only thing I have

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 18, 2022 at 04:25:45PM +, Anonymouse via Digitalmars-d-learn wrote: > I did a big sweep through my project and changed all `writefln`s and > `format`s and the such to take their format patterns as compile-time > parameters, and now ldc can no longer build it on Windows. It works

Re: How to alias

2022-01-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 14 January 2022 at 18:04:35 UTC, kyle wrote: Thanks Adam. We need a repository of articles about stuff that doesn't do what people expect. I put this as a tip of the week in my late post: http://dpldocs.info/this-week-in-d/Blog.Posted_2022_01_10.html#tip-of-the-week My blog

Re: number ranges

2022-01-18 Thread forkit via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 16:02:42 UTC, Tejas wrote: Newer languages nowadays use `start..intent, think it's something we should follow? I've decided to avoid using number ranges 'directly', and instead use a wrapper function... auto range(T:T)(T a, T b) { import std.range :

Re: number ranges

2022-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 18, 2022 at 04:02:42PM +, Tejas via Digitalmars-d-learn wrote: [...] > Newer languages nowadays use `start.. it's something we should follow? I've never seen that before. Which languages use that? T -- "If you're arguing, you're losing." -- Mike Thomas

Re: number ranges

2022-01-18 Thread Ali Çehreli via Digitalmars-d-learn
On 1/18/22 12:43, forkit wrote: > wrapper function... > > > auto range(T:T)(T a, T b) > { > import std.range : iota; > return iota(a, (b+1)); > } Needs a little more work to be correct. The following produces and empty range. ;) range(uint.min, uint.max) Also, is it important

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 17:37:27 UTC, H. S. Teoh wrote: Bypassing dub and calling the raw ldc command gives no output. What else can I do? What does `echo $?` print immediately after you run the raw ldc command? T It exits with 5. I could look for that, certainly.

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 18, 2022 at 05:41:34PM +, Anonymouse via Digitalmars-d-learn wrote: > On Tuesday, 18 January 2022 at 17:37:27 UTC, H. S. Teoh wrote: > > > Bypassing dub and calling the raw ldc command gives no output. > > > What else can I do? > > > > What does `echo $?` print immediately after

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread russhy via Digitalmars-d-learn
Compiling the project without: version "Colours" works So the problem lies here in this struct: https://github.com/zorael/kameloso/blob/9ccff29ead6ca2e80e2db0f06085c751326ed578/source/kameloso/constants.d#L320

Re: shared defaultlib with dmd

2022-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 18, 2022 at 10:04:15PM +, forkit via Digitalmars-d-learn wrote: > so I use this compile command (on Windows, using ldc) > > -link-defaultlib-shared=true > > Then (in simple example) the size of my compiled .exe: > > From 806KB down to 18KB > > Oh. That's so much nicer on my SSD

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread kinke via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 16:25:45 UTC, Anonymouse wrote: What can I *reasonably* do here? Do I *have* to compile LDC from source, to get debug symbols? How else can I reduce it when it doesn't say what goes wrong? [-1073741819 == 0xc005 => access violation] Some options: 1. This

shared defaultlib with dmd

2022-01-18 Thread forkit via Digitalmars-d-learn
so I use this compile command (on Windows, using ldc) -link-defaultlib-shared=true Then (in simple example) the size of my compiled .exe: From 806KB down to 18KB Oh. That's so much nicer on my SSD ;-) (yes, I understand the implictions here of dynamic sharing, but I test/compile/debug so

Re: shared defaultlib with dmd

2022-01-18 Thread forkit via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 22:09:18 UTC, Adam D Ruppe wrote: On Tuesday, 18 January 2022 at 22:04:15 UTC, forkit wrote: so I use this compile command (on Windows, using ldc) On Linux dmd can do `-defaultlib=libphobos2.so` for the same thing. On Windows, dmd cannot handle a shared

Re: number ranges

2022-01-18 Thread forkit via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 20:50:06 UTC, Ali Çehreli wrote: Needs a little more work to be correct. The following produces and empty range. ;) range(uint.min, uint.max) Also, is it important for the result to be the same as T? For example, even if T is ubyte, because b+1 is 'int',

Re: shared defaultlib with dmd

2022-01-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 22:04:15 UTC, forkit wrote: so I use this compile command (on Windows, using ldc) On Linux dmd can do `-defaultlib=libphobos2.so` for the same thing. On Windows, dmd cannot handle a shared druntime.

Re: shared defaultlib with dmd

2022-01-18 Thread forkit via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 22:35:08 UTC, H. S. Teoh wrote: On Tue, Jan 18, 2022 at 10:04:15PM +, forkit via Digitalmars-d-learn wrote: so I use this compile command (on Windows, using ldc) -link-defaultlib-shared=true Then (in simple example) the size of my compiled .exe: From 806KB

Re: number ranges

2022-01-18 Thread Ali Çehreli via Digitalmars-d-learn
On 1/18/22 14:08, forkit wrote: > never use number ranges.. not ever! ;-) > > (except in combination with iota) Indeed, the following is an elegant but slow (tested with dmd) implementation with Phobos: auto range(T)(T a, T b) in (a <= b) { import std.range : chain, iota, only; return

Re: number ranges

2022-01-18 Thread Tejas via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 17:58:54 UTC, H. S. Teoh wrote: On Tue, Jan 18, 2022 at 04:02:42PM +, Tejas via Digitalmars-d-learn wrote: [...] Newer languages nowadays use `start..intent, think it's something we should follow? I've never seen that before. Which languages use that? T

Re: number ranges

2022-01-18 Thread Tejas via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 20:43:08 UTC, forkit wrote: On Tuesday, 18 January 2022 at 16:02:42 UTC, Tejas wrote: Newer languages nowadays use `start..intent, think it's something we should follow? I've decided to avoid using number ranges 'directly', and instead use a wrapper

Re: number ranges

2022-01-18 Thread forkit via Digitalmars-d-learn
On Wednesday, 19 January 2022 at 03:00:49 UTC, Tejas wrote: On Tuesday, 18 January 2022 at 20:43:08 UTC, forkit wrote: On Tuesday, 18 January 2022 at 16:02:42 UTC, Tejas wrote: Newer languages nowadays use `start..intent, think it's something we should follow? I've decided to avoid using

Re: number ranges

2022-01-18 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 17 January 2022 at 22:28:10 UTC, H. S. Teoh wrote: This will immediately make whoever reads the code (i.e., myself after 2 months :D) wonder, "why +1?" And the answer will become clear and enlightenment ensues. ;-) In those cases i find myself rewriting said code. Generally to

Debug symbols from libs not being linked on windows

2022-01-18 Thread Hipreme via Digitalmars-d-learn
I have separated my project in a bunch of modules to be compiled separated. But it seems I have lost my debugging power since then. I would like to know if there is any workaround beside not using it as a lib. I'm using it from dub and it is has the debug options on them: ``` "buildOptions":

Re: alias and __VERSION__ condition doesn't play well

2022-01-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/18/22 7:19 AM, vit wrote: On Tuesday, 18 January 2022 at 12:05:38 UTC, Paul Backus wrote: On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote: At the very top of my module I have this declaration: ```d static if (__VERSION__ >= 2098) {     alias Foo = TypeA; } else {     alias Foo =

Re: alias and __VERSION__ condition doesn't play well

2022-01-18 Thread vit via Digitalmars-d-learn
On Wednesday, 19 January 2022 at 04:15:54 UTC, Steven Schveighoffer wrote: On 1/18/22 7:19 AM, vit wrote: On Tuesday, 18 January 2022 at 12:05:38 UTC, Paul Backus wrote: On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote: At the very top of my module I have this declaration: ```d