Re: getopt usage help to stderr?

2025-05-12 Thread Justin Allen Parrott via Digitalmars-d-learn
On Wednesday, 9 April 2025 at 01:23:01 UTC, Salih Dincer wrote: On Tuesday, 8 April 2025 at 20:14:56 UTC, Andy Valencia wrote: p.s. Ironically, I could probably have coded a getopt in less time than I've spent on std.getopt... :) Please try the following example with the parameters -h, -e,

Re: const main args?

2025-05-12 Thread Justin Allen Parrott via Digitalmars-d-learn
On Friday, 12 August 2011 at 22:51:34 UTC, Andrej Mitrovic wrote: That's pretty stupid, of course you want to modify the arguments. Classic example: void main(string[] args) { args.popFront; // get rid of name foreach (arg; args) { } } Shouldn’t do this

Tokens

2025-05-12 Thread Justin Allen Parrott via Digitalmars-d-learn
I don’t like [$-1], I want to define a token L to be $-1 and use o[L]

Re: Capture context surrounding delegate

2025-05-12 Thread Justin Allen Parrott via Digitalmars-d-learn
On Saturday, 10 May 2025 at 04:52:15 UTC, Python wrote: getchar(); I don’t like this

Re: Capture context surrounding delegate

2025-05-12 Thread Python via Digitalmars-d-learn
On Monday, 12 May 2025 at 08:35:02 UTC, Justin Allen Parrott wrote: On Saturday, 10 May 2025 at 04:52:15 UTC, Python wrote: getchar(); I don’t like this Poor man's tool to keep my threads running.

Re: Capture context surrounding delegate

2025-05-12 Thread Justin Allen Parrott via Digitalmars-d-learn
On Monday, 12 May 2025 at 14:10:41 UTC, Python wrote: On Monday, 12 May 2025 at 08:35:02 UTC, Justin Allen Parrott wrote: On Saturday, 10 May 2025 at 04:52:15 UTC, Python wrote: getchar(); I don’t like this Poor man's tool to keep my threads running. Thread-wait or join

Is this dub link flag (-L-lcudart_static) a bug?

2025-05-12 Thread mw via Digitalmars-d-learn
Hi, With ``` $ dub --version DUB version 1.39.0, built on Mar 20 2025 $ ldc2 --version LDC - the LLVM D compiler (1.40.1): ``` dub.json: ``` "lflags": [ ... "-L/usr/local/cuda/lib64", "-lcudart_static", ... ], ``` I got a link error: `undefined reference to 'cudaGetDeviceProp

Re: Debugging on Windows

2025-05-12 Thread Justin Allen Parrott via Digitalmars-d-learn
On Wednesday, 16 April 2025 at 20:08:00 UTC, Arokh Slade wrote: Any tips? Debuggers phased out in the nineties

Re: const main args?

2025-05-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 12, 2025 1:01:49 AM Mountain Daylight Time Justin Allen Parrott via Digitalmars-d-learn wrote: > On Friday, 12 August 2011 at 22:51:34 UTC, Andrej Mitrovic wrote: > > That's pretty stupid, of course you want to modify the > > arguments. > > > > Classic example: > > > > void main(str

How to replicate an Error: scope variable `old` assigned to `ref` variable `ctx` with longer lifetime?

2025-05-12 Thread matheus via Digitalmars-d-learn
I saw a post (https://forum.dlang.org/post/aklmfkzqpsraprjfx...@forum.dlang.org) by Dennis where he gives an example: Finally, mechanical scope checking has false positives: ```D void f(ref scope S ctx) { const old = ctx; g(ctx); ctx = old; // Error: scope variable `old` assigned to `r

Re: How to replicate an Error: scope variable `old` assigned to `ref` variable `ctx` with longer lifetime?

2025-05-12 Thread Dennis via Digitalmars-d-learn
On Monday, 12 May 2025 at 21:46:04 UTC, matheus wrote: I saw a post (https://forum.dlang.org/post/aklmfkzqpsraprjfx...@forum.dlang.org) by Dennis where he gives an example: So I'd like to try it out, so I wrote the snippet below: @safe import std; struct S{} Make sure S contains at least o

Re: CTFE and RTFE results differ (aliasing)

2025-05-12 Thread kdevel via Digitalmars-d-learn
On Monday, 5 May 2025 at 17:15:57 UTC, kdevel wrote: ``` auto foo (ubyte [4] s) { auto u = s; ubyte [4] tmp = u; ``` When I put `shared` in front of that definition the unittest passes. ``` u[0] = tmp [3]; u[1] = tmp [2]; u[2] = tmp [1]; u[3] = tmp [0]; return u; } ```

Re: Tokens

2025-05-12 Thread Ali Çehreli via Digitalmars-d-learn
On 5/12/25 12:10 AM, Justin Allen Parrott wrote: I don’t like [$-1], I want to define a token L to be $-1 and use o[L] I like o.back: import std.range; void main() { int[] o = [ 1, 2, 3 ]; assert(o[$-1] == o.back); assert(&(o[$-1]) == &(o.back)); } Ali