Re: Issue with struct invariants

2025-03-05 Thread kdevel via Digitalmars-d-learn
On Wednesday, 5 March 2025 at 16:58:18 UTC, Kirill Kryukov wrote: Is this a bug, or am I misunderstanding something? Compiled with "gdc -Og -o repro repro.d", using gdc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3), on Linux. Compiled your code with DMD v2.109.1, gdc (GCC) 11.3.0 and gdc (GCC) 12

Re: UTF-8 char and write(f)ln

2025-03-05 Thread Ali Çehreli via Digitalmars-d-learn
On 3/5/25 11:59 AM, Vindex9 wrote: > On Wednesday, 5 March 2025 at 17:56:25 UTC, Ali Çehreli wrote: >> It shouldn't and does not work in my environment (both inside an Emacs >> buffer and inside a Linux terminal). > The program just outputs characters to its stdout. One way to see this process i

Re: UTF-8 char and write(f)ln

2025-03-05 Thread Vindex9 via Digitalmars-d-learn
On Wednesday, 5 March 2025 at 17:56:25 UTC, Ali Çehreli wrote: It shouldn't and does not work in my environment (both inside an Emacs buffer and inside a Linux terminal). I used Terminator. I tried other terminal emulators and they behaved differently (output unrecognized bits of characters as

Re: UTF-8 char and write(f)ln

2025-03-05 Thread Ali Çehreli via Digitalmars-d-learn
On 3/4/25 12:09 AM, Vindex9 wrote: > Program: > ```d > import std.stdio; > > void main() { > string s = "ταυ"; > foreach(i, elem; s) { > writefln("%s %s '%s'", i, cast(int)elem, elem); > writefln("%s", elem); > } > } > > ``` > Output: > ``` > 0 207 '�' > > 1 132 '�

Re: Issue with struct invariants

2025-03-05 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 5 March 2025 at 16:58:18 UTC, Kirill Kryukov wrote: Hi all, I was debugging an old project that started crashing after upgrading to a recent toolchain. I noticed that commenting out invariants helps. I reduced it to the following: [...] Is this a bug, or am I misunderstanding

Re: Issue with struct invariants

2025-03-05 Thread Sergey via Digitalmars-d-learn
On Wednesday, 5 March 2025 at 16:58:18 UTC, Kirill Kryukov wrote: Hi all, Is this a bug, or am I misunderstanding something? Compiled with "gdc -Og -o repro repro.d", using gdc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3), on Linux. Thanks. It seems working with dmd and ldc. Maybe GDC specific

Issue with struct invariants

2025-03-05 Thread Kirill Kryukov via Digitalmars-d-learn
Hi all, I was debugging an old project that started crashing after upgrading to a recent toolchain. I noticed that commenting out invariants helps. I reduced it to the following: ``` import std.conv: to; struct A { ulong n; string str() { if (n == 0) { return "0"; }