Re: Operator "+=" overloading for class?

2023-12-20 Thread Ki Rill via Digitalmars-d-learn
On Wednesday, 20 December 2023 at 02:56:24 UTC, Steven Schveighoffer wrote: Instead you are trying to reassign the `this` reference, which is a local (and also forbidden). Think about it a second, your `this + rhs` is going to allocate a *new* object. Then if the assignment to the local `this`

Re: std.int128 not working with -betterC enabled

2023-12-20 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 21/12/2023 10:51 AM, Renato wrote: On Wednesday, 20 December 2023 at 19:11:15 UTC, Richard (Rikki) Andrew Cattermole wrote: Yes that is to be expected. It is not templated, and hasn't been compiled into your program. How do I compile that into my program? You copy the file from druntime

Re: std.int128 not working with -betterC enabled

2023-12-20 Thread Renato via Digitalmars-d-learn
On Wednesday, 20 December 2023 at 19:11:15 UTC, Richard (Rikki) Andrew Cattermole wrote: Yes that is to be expected. It is not templated, and hasn't been compiled into your program. How do I compile that into my program?

Re: std.int128 not working with -betterC enabled

2023-12-20 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Yes that is to be expected. It is not templated, and hasn't been compiled into your program.

Re: std.int128 not working with -betterC enabled

2023-12-20 Thread Renato via Digitalmars-d-learn
On Wednesday, 20 December 2023 at 18:46:41 UTC, Renato wrote: ``` dmd -L-ld_classic -unittest -checkaction=context -run main.d Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable (maybe you meant: __D4core6thread10threadbase1

Re: std.int128 not working with -betterC enabled

2023-12-20 Thread Renato via Digitalmars-d-learn
On Wednesday, 20 December 2023 at 18:16:00 UTC, Renato wrote: But with -betterC: ``` dmd -L-ld_classic -betterC -run dasc.d Undefined symbols for architecture x86_64: "__D3std6int1286Int1286__ctorMFNaNbNcNiNfllZSQBpQBoQBk", referenced from: _main in dasc.o ld: symbol(s) not found for

std.int128 not working with -betterC enabled

2023-12-20 Thread Renato via Digitalmars-d-learn
I wanted to write a small program using betterC that needs to use int128. This simple program works without -betterC: ```d module dasc; import std.int128; import core.stdc.stdio; extern (C): int main() { auto n = Int128(128, 128); printf("n=%lu%lu", n.data.hi, n.data.lo); return 42; }

Re: D is nice whats really wrong with gc??

2023-12-20 Thread Imperatorn via Digitalmars-d-learn
On Monday, 18 December 2023 at 17:22:22 UTC, H. S. Teoh wrote: On Mon, Dec 18, 2023 at 04:44:11PM +, Bkoie via Digitalmars-d-learn wrote: [...] but what is with these ppl and the gc? [...] It's called GC phobia, a knee-jerk reaction malady common among C/C++ programmers (I'm one of them,

How to set linkage?

2023-12-20 Thread Quirin Schroll via Digitalmars-d-learn
In the DMD compiler frontend, the type `TypeFunction` (cf. astbase.d) representing a function type has a `linkage` member. Setting this member when parsing seems to have no effect. How do I set the linkage of a function type? For alias declarations which support setting function type linkage,

Re: Compiler analysis fault?

2023-12-20 Thread Dennis via Digitalmars-d-learn
On Wednesday, 20 December 2023 at 11:33:22 UTC, DLearner wrote: The code below fails to compile with Error: function `test1.foo` no `return exp;` or `assert(0);` at end of function unless the commented-out assert(0) is included. The compiler basically gives up control flow analysis when enc

Compiler analysis fault?

2023-12-20 Thread DLearner via Digitalmars-d-learn
The code below fails to compile with Error: function `test1.foo` no `return exp;` or `assert(0);` at end of function unless the commented-out assert(0) is included. Please, what rule of D is being broken? foo does not unconditionally loop, and the only places where foo returns, it returns wit