Re: Do I have to pass parameters with ref explicitly?

2022-04-16 Thread Elfstone via Digitalmars-d-learn
On Sunday, 17 April 2022 at 04:00:19 UTC, max haughton wrote: On Sunday, 17 April 2022 at 03:00:28 UTC, Elfstone wrote: I'm reading some d-sources, and it looks like they pass big structs by value. Such as: Matrix4x4f opBinary(string op)(Matrix4x4f rhs) { ... } I came from a C++

Re: Do I have to pass parameters with ref explicitly?

2022-04-16 Thread max haughton via Digitalmars-d-learn
On Sunday, 17 April 2022 at 03:00:28 UTC, Elfstone wrote: I'm reading some d-sources, and it looks like they pass big structs by value. Such as: Matrix4x4f opBinary(string op)(Matrix4x4f rhs) { ... } I came from a C++ background, and I would have written: Matrix4x4f opBinary(string

Do I have to pass parameters with ref explicitly?

2022-04-16 Thread Elfstone via Digitalmars-d-learn
I'm reading some d-sources, and it looks like they pass big structs by value. Such as: Matrix4x4f opBinary(string op)(Matrix4x4f rhs) { ... } I came from a C++ background, and I would have written: Matrix4x4f opBinary(string op)(const ref Matrix4x4f rhs) { ... } I haven't found

Re: Beginner memory question.

2022-04-16 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 16 April 2022 at 20:41:25 UTC, WhatMeWorry wrote: Is virtual memory entering into the equation? Probably. Memory allocated doesn't physically exist until written to a lot of the time.

Re: module search paths

2022-04-16 Thread kdevel via Digitalmars-d-learn
On Saturday, 16 April 2022 at 13:45:17 UTC, kdevel wrote: [...] Will that be corrected in GCC 11.3 or not until GCC 12? GCC 12.

Beginner memory question.

2022-04-16 Thread WhatMeWorry via Digitalmars-d-learn
I'm playing around with dynamic arrays and I wrote the tiny program (at bottom). I get the following output: PS C:\D\sandbox> dmd -m64 maxMem.d PS C:\D\sandbox> .\maxMem.exe Reserving 1,610,613,245 elements reserve() returned a size of: 1,610,613,245 The capacity() of big is 1,610,613,245

Re: TIC-80 WebAssembly: pointers to fixed addresses

2022-04-16 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 16 April 2022 at 14:29:09 UTC, Pierce Ng wrote: ``` pub const FRAMEBUFFER: *allowzero volatile [16320]u8 = @intToPtr(*allowzero volatile [16320]u8, 0); pub const TILES : *[8192]u8 = @intToPtr(*[8192]u8, 0x4000); pub const SPRITES : *[8192]u8 = @intToPtr(*[8192]u8, 0x6000); ``` I

TIC-80 WebAssembly: pointers to fixed addresses

2022-04-16 Thread Pierce Ng via Digitalmars-d-learn
Hi all, D newbie here. I'm building a D WebAssembly binding for [TIC-80](https://github.com/nesbox/TIC-80), a fantasy gaming console. TIC-80 has a [fixed size RAM](https://github.com/nesbox/TIC-80/wiki/RAM) that is directly addressable by a running program using peek() and poke()

Re: module search paths

2022-04-16 Thread kdevel via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 09:41:45 UTC, Mathias LANG wrote: [...] JSONType used to be named `JSON_TYPE`, and this was changed in v2.082.0. I think GDC-11 is somewhere around v2.076.0 (with a lot of backport for bugs, but no feature / Phobos backport). Since v2.082.0 was released

Re: Template name undefined when import from "library" target.

2022-04-16 Thread Elfstone via Digitalmars-d-learn
On Saturday, 16 April 2022 at 11:45:38 UTC, Elfstone wrote: I'm building my first program with dub. It appears I can import and use a struct from a "library". But the template struct is undefined unless I change the target type to "sourceLibrary". The sources are like this: What am I

Template name undefined when import from "library" target.

2022-04-16 Thread Elfstone via Digitalmars-d-learn
I'm building my first program with dub. It appears I can import and use a struct from a "library". But the template struct is undefined unless I change the target type to "sourceLibrary". The sources are like this: // library // shapes.d module core.shapes;

Can Enums be integral types?

2022-04-16 Thread Manfred Nowak via Digitalmars-d-learn
In the specs(17) about enums the word "integral" has no match. But because the default basetype is `int`, which is an integral type, enums might be integral types whenever their basetype is an integral type. On the other hand the specs(7.6.5.3) about types say | A bool value can be implicitly

how can i mixin a function as struct or class member function

2022-04-16 Thread mycybyby via Digitalmars-d-learn
for example: function void a(int i) { writeln(i); } auto JSFunction(alias F)() if(isSomeFunction!F) { class S { public ReturnType!F dg(ParameterTypeTuple!F) { mixin(F.body) // what should i do ??? } } } thank you