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

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 be

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 file:

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: phobos build issue with dmd-2.102.2 (RESOLVED)

2023-05-08 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: Indenting standards religions K&R, 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 (Edi

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: 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 'dmd

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: 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 characte

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: 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; ++i)

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 jo

Re: Integer precision of function return types

2024-09-26 Thread thinkunix via Digitalmars-d-learn
Per Nordlöw via Digitalmars-d-learn wrote: Should a function like ```d uint parseHex(in char ch) pure nothrow @safe @nogc { switch (ch) { case '0': .. case '9':     return ch - '0'; case 'a': .. case 'f':     return 10 + ch - 'a'; case 'A': .. case 'F':     ret

Re: Integer precision of function return types

2024-09-27 Thread thinkunix via Digitalmars-d-learn
Jonathan M Davis via Digitalmars-d-learn wrote: Well, I don't think that auto is a particularly controversial topic among D programmers... Thank you Jonathan for that very detailed response. This thread can end now unless others really feel the need to comment. I got two outstanding responses

Re: Integer precision of function return types

2024-09-27 Thread thinkunix via Digitalmars-d-learn
H. S. Teoh via Digitalmars-d-learn wrote: In idiomatic D, you'd use `auto` when either (1) you don't care what the type is, you just want whatever value you get to be shoved into a variable, or (2) you *shouldn't* care what the type is, because your code shouldn't be depending on it, e.g., when y

Re: Integer precision of function return types

2024-09-27 Thread thinkunix via Digitalmars-d-learn
monkyyy via Digitalmars-d-learn wrote: On Friday, 27 September 2024 at 04:23:32 UTC, thinkunix wrote: What about using 'auto' as the return type? I tried it and it seemed to work OK. Wondering if there are any good reasons to use auto, or bad reasons why not to use auto here? You have starte