Re: string from C function

2025-05-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, May 7, 2025 10:51:27 PM Mountain Daylight Time Andy Valencia via Digitalmars-d-learn wrote: > On Thursday, 8 May 2025 at 00:53:20 UTC, Mike Parker wrote: > >> tst44.d(6): Error: cannot implicitly convert expression > >> `fromStringz(ctime(null))` of type `char[]` to `string` > > `fro

Re: const main args?

2025-05-13 Thread monkyyy via Digitalmars-d-learn
On Tuesday, 13 May 2025 at 16:25:25 UTC, Ali Çehreli wrote: On 5/13/25 6:27 AM, Justin Allen Parrott wrote: There is absolutely nothing wrong with it. It is bad language First, thanks for reviving a thread from 2011. For the record, neither the D programming language nor Jonathan M Davis' E

Re: Debugging on Windows

2025-05-13 Thread Justin Allen Parrott via Digitalmars-d-learn
On Tuesday, 13 May 2025 at 14:19:41 UTC, Python wrote: On Monday, 12 May 2025 at 07:33:34 UTC, Justin Allen Parrott wrote: On Wednesday, 16 April 2025 at 20:08:00 UTC, Arokh Slade wrote: Any tips? Debuggers phased out in the nineties Press F12 in your browser. You'll be surprised. I am not

Re: const main args?

2025-05-13 Thread Ali Çehreli via Digitalmars-d-learn
On 5/13/25 6:27 AM, Justin Allen Parrott wrote: There is absolutely nothing wrong with it. It is bad language First, thanks for reviving a thread from 2011. For the record, neither the D programming language nor Jonathan M Davis' English is bad. Slice operations are very common and very us

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

2025-05-13 Thread Dennis via Digitalmars-d-learn
On Tuesday, 13 May 2025 at 12:22:44 UTC, matheus wrote: Maybe the compiler it should give an warning in that @safe without ":" when marking all the file? `@safe`, like any attribute, can be applied in multiple ways: ```D // apply to next declaration attr declaration; // apply to a scope of de

Re: Debugging on Windows

2025-05-13 Thread Python via Digitalmars-d-learn
On Monday, 12 May 2025 at 07:33:34 UTC, Justin Allen Parrott wrote: On Wednesday, 16 April 2025 at 20:08:00 UTC, Arokh Slade wrote: Any tips? Debuggers phased out in the nineties Press F12 in your browser. You'll be surprised.

Re: const main args?

2025-05-13 Thread Justin Allen Parrott via Digitalmars-d-learn
There is absolutely nothing wrong with it. It is bad language

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

2025-05-13 Thread matheus via Digitalmars-d-learn
On Monday, 12 May 2025 at 22:57:22 UTC, Dennis wrote: 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 im

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

2025-05-13 Thread matheus via Digitalmars-d-learn
On Tuesday, 13 May 2025 at 12:08:09 UTC, Dennis wrote: On Tuesday, 13 May 2025 at 11:55:21 UTC, matheus wrote: Unfortunately adding the pointer gives me another error: I added @safe: and replaced `const` with `auto` because casting away const isn't safe. This should do it: ... Indeed it w

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

2025-05-13 Thread Dennis via Digitalmars-d-learn
On Tuesday, 13 May 2025 at 11:55:21 UTC, matheus wrote: Unfortunately adding the pointer gives me another error: I added @safe: and replaced `const` with `auto` because casting away const isn't safe. This should do it: ```D // compile with -preview=dip1000 import std; @safe: struct S { int