How to workaround assignment not allowed in a condition?

2022-10-11 Thread Steven Schveighoffer via Digitalmars-d-learn
Porting some C code to D This results in an error: ```d int x; while(!(x = 5)) { break; } ``` Error is: assignment cannot be used as a condition, perhaps `==` was meant? OK, fine, I'll use `==`: ```d int x; while(!(x = 5) == true) { break; } ``` Nope, same error. I tried reversing the

Re: DateTime resetting

2022-10-11 Thread Joel via Digitalmars-d-learn
On Tuesday, 11 October 2022 at 23:28:50 UTC, Adam D Ruppe wrote: I'm just eyeballing the code, is it the g_dateTimeCursor you're concerned about? That's the only one I really see there. [...] Yes! :-D getControl was the issue, I've used ref on its return value now. Thanks so much for your

Re: DateTime resetting

2022-10-11 Thread Adam D Ruppe via Digitalmars-d-learn
I'm just eyeballing the code, is it the g_dateTimeCursor you're concerned about? That's the only one I really see there. A few things that might explain it: 1) as a global variable, it is thread local. I don't see any use of threads in here, but if you do, each one has a separate copy and

Re: DateTime resetting

2022-10-11 Thread Joel via Digitalmars-d-learn
On Tuesday, 11 October 2022 at 22:21:35 UTC, Adam D Ruppe wrote: On Tuesday, 11 October 2022 at 22:09:34 UTC, Joel wrote: I've been working on a diary program (ChronoLog). but lately my date and time variable keeps resetting. I've spent hours trying to fix it. I'm wondering if there's a known

Re: DateTime resetting

2022-10-11 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 11 October 2022 at 22:09:34 UTC, Joel wrote: I've been working on a diary program (ChronoLog). but lately my date and time variable keeps resetting. I've spent hours trying to fix it. I'm wondering if there's a known issue. An ordinary DateTime variable? Those are pretty simple

DateTime resetting

2022-10-11 Thread Joel via Digitalmars-d-learn
I've been working on a diary program (ChronoLog). but lately my date and time variable keeps resetting. I've spent hours trying to fix it. I'm wondering if there's a known issue.

Re: dub install package globally

2022-10-11 Thread Preetpal via Digitalmars-d-learn
On Thursday, 6 October 2022 at 08:50:02 UTC, christian.koestlin wrote: On Thursday, 6 October 2022 at 07:06:52 UTC, Preetpal wrote: Is there a way to install packages "globally" using dub? For example, when using the node package manager (NPM) you can install a package "globally" (so it is