Re: length's type.

2024-02-09 Thread thinkunix via Digitalmars-d-learn
Kevin Bailey via Digitalmars-d-learn wrote: On Thursday, 8 February 2024 at 08:23:12 UTC, thinkunix wrote: I would never write code like this. By all means, please share with us how you would have written that just as elegantly but "correct". First off I, I am just a beginner with D. I

Re: length's type.

2024-02-08 Thread thinkunix via Digitalmars-d-learn
Kevin Bailey via Digitalmars-d-learn wrote: How many times does the following loop print? I ran into this twice doing the AoC exercises. It would be nice if it Just Worked. ``` import std.stdio; int main() {   char[] something = ['a', 'b', 'c'];   for (auto i = -1; i < something.length;

Re: Providing implicit conversion of

2024-01-21 Thread thinkunix via Digitalmars-d-learn
Gavin Gray via Digitalmars-d-learn wrote: The following code:   ulong charlie = 11;   long johnstone = std.algorithm.comparison.max(0, -charlie);   writeln(format!"johnstone %s"(johnstone)); Results in (without any warning(s)): johnstone -11 However you choose to look at it, this means -11

Re: Reading .txt File into String and Matching with RegEx

2023-12-10 Thread thinkunix via Digitalmars-d-learn
BoQsc via Digitalmars-d-learn wrote: This is something I've searched on the forum and couldn't find exact answer. TLDR: `r"^."` is matching the very first two character in the `input` string. Don't you need two dots to match two characters? Each dot being the regex to match a single

Re: anonymous structs within structs

2023-12-04 Thread thinkunix via Digitalmars-d-learn
DLearner via Digitalmars-d-learn wrote: On Monday, 4 December 2023 at 21:55:29 UTC, Mike Shah wrote: [...] Is something like this what you had in mind? ``` void main() {    import std.stdio;    mixin template A() {   int I1;   int I2;   char X;    }    struct B {   mixin A;

Re: cannot find source code for runtime library file 'object.d'

2023-11-22 Thread thinkunix via Digitalmars-d-learn
denis via Digitalmars-d-learn wrote: On Monday, 20 November 2023 at 07:50:22 UTC, thinkunix wrote: denis via Digitalmars-d-learn wrote: ``` $ zypper install dmd $ dmd main.d Error: cannot find source code for runtime library file 'object.d'     dmd might not be correctly installed. Run

Re: cannot find source code for runtime library file 'object.d'

2023-11-20 Thread thinkunix via Digitalmars-d-learn
denis via Digitalmars-d-learn wrote: ``` $ zypper install dmd $ dmd main.d Error: cannot find source code for runtime library file 'object.d'    dmd might not be correctly installed. Run 'dmd -man' for installation instructions.    config file: /etc/dmd.conf I would say the package

Re: Indenting standards religions K, whitesmiths etc

2023-05-31 Thread thinkunix via Digitalmars-d-learn
matheus via Digitalmars-d-learn wrote: On Wednesday, 31 May 2023 at 16:24:38 UTC, Cecil Ward wrote: ... So my question: would I get lynched for the following? (below) ... I don't know nothing about all this but looking your example code, I write and I'd prefer to read something like this

Re: phobos build issue with dmd-2.102.2 (RESOLVED)

2023-05-09 Thread thinkunix via Digitalmars-d-learn
This is a followup to my original post on March 9 about issues building dmd-2.102.2 on an old Linux x86_64 system. See bugzilla: https://issues.dlang.org/show_bug.cgi?id=23846 The short answer is it is fixed as of dmd-2.104.0-beta.1, that version now builds dmd and phobos successfully.

Re: Linking external functions?

2023-04-18 Thread thinkunix via Digitalmars-d-learn
DLearner via Digitalmars-d-learn wrote: On Tuesday, 18 April 2023 at 21:31:21 UTC, thinkunix wrote: [...] If not calling C code, why use extern(C) for D code? Wanted to test out options of calling D routine (possibly -betterC) from both C and (full) D. OK, thanks.

Re: Linking external functions?

2023-04-18 Thread thinkunix via Digitalmars-d-learn
DLearner via Digitalmars-d-learn wrote: Wanted to try out linking two source files independantly compiled. ExtCallee.d source file: ``` extern(C) void ExtCallee() {    import std.stdio;    writeln("Entered: ", __FUNCTION__);    writeln("Exiting: ", __FUNCTION__); } ``` ExtMain.d source

Re: short guide on getting started with D

2023-04-04 Thread thinkunix via Digitalmars-d-learn
cgenie via Digitalmars-d-learn wrote: Hello, I created a short guide on getting started with D: https://blog.mmksoft.uk/#A%20short%20guide%20on%20getting%20started%20with%20D%20programming This is because I recently I started to explore the language and, having read the forum, I see DUB

phobos build issue with dmd-2.102.2

2023-03-08 Thread thinkunix via Digitalmars-d-learn
Hello all, I have an older system I am trying to build dmd-2.102.2 on from source: stock Slackware 14.0 x86_64 binutils 2.22.52.0.2, gcc 4.7.1, glibc 2.15, kernel 3.2.x, and dmd-2.102.1 installed (which I built from source on this system) I started with dmd-2.067.1, bootstrapped it with only a