Re: scope parameter has effect only on pointers?

2025-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 27, 2025 10:31:42 AM Mountain Daylight Time Quirin Schroll via Digitalmars-d-learn wrote: > On Tuesday, 24 June 2025 at 02:05:40 UTC, Jonathan M Davis wrote: > > There's also the issue of templated code. If an attribute is > > desirable in the cases where it works, and it's fine fo

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 27, 2025 1:55:30 PM Mountain Daylight Time WraithGlade via Digitalmars-d-learn wrote: > Thanks for responding to my question and for your time, etc. > > I was aware of `align` but as far as I am aware it is orthogonal > to what I'm asking about. The Andrei book says that D > automa

Re: tupleof of class instance... but enumerate _all_ the instance variables

2025-06-27 Thread monkyyy via Digitalmars-d-learn
On Friday, 27 June 2025 at 22:33:25 UTC, Andy Valencia wrote: tupleof works for struct and class instances, but explicitly documents that it ignores instance variables from any superclass. Is there any way to enumerate _all_ the instance variables, not just the ones present in the specific in

tupleof of class instance... but enumerate _all_ the instance variables

2025-06-27 Thread Andy Valencia via Digitalmars-d-learn
tupleof works for struct and class instances, but explicitly documents that it ignores instance variables from any superclass. Is there any way to enumerate _all_ the instance variables, not just the ones present in the specific instance's class? Thanks, Andy

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread Dejan Lekic via Digitalmars-d-learn
On Friday, 27 June 2025 at 19:55:30 UTC, WraithGlade wrote: orthogonal to what I'm asking about. The Andrei book says that D automatically rearranges members of `class`s in memory to avoid wasting memory due to padding between members whose width is less than the native CPU word size alignment,

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread Lance Bachmeier via Digitalmars-d-learn
On Friday, 27 June 2025 at 19:55:30 UTC, WraithGlade wrote: Thanks for responding to my question and for your time, etc. I was aware of `align` but as far as I am aware it is orthogonal to what I'm asking about. The Andrei book says that D automatically rearranges members of `class`s in memory

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread WraithGlade via Digitalmars-d-learn
Thanks for responding to my question and for your time, etc. I was aware of `align` but as far as I am aware it is orthogonal to what I'm asking about. The Andrei book says that D automatically rearranges members of `class`s in memory to avoid wasting memory due to padding between members whos

Re: scope parameter has effect only on pointers?

2025-06-27 Thread Quirin Schroll via Digitalmars-d-learn
On Tuesday, 24 June 2025 at 02:05:40 UTC, Jonathan M Davis wrote: There's also the issue of templated code. If an attribute is desirable in the cases where it works, and it's fine for it to be ignored in the cases where it doesn't apply, then that means that you can have code such as ```d scop

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread Dejan Lekic via Digitalmars-d-learn
On Friday, 27 June 2025 at 11:23:56 UTC, WraithGlade wrote: I've read both of the available printed D books in their entirety (Ali's and Andrei's) and I noticed Andrei's book (circa ~2010) mentions that the D compiler rearranges the members of `class` objects to be more optimal by reducing ali

Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread WraithGlade via Digitalmars-d-learn
I've read both of the available printed D books in their entirety (Ali's and Andrei's) and I noticed Andrei's book (circa ~2010) mentions that the D compiler rearranges the members of `class` objects to be more optimal by reducing alignment-induced padding whereas it leaves the alignment-induce

Re: My tiny but useful trace debugging code... Any suggestions from more experienced D users?

2025-06-27 Thread WraithGlade via Digitalmars-d-learn
Oh, and here's another minor update. I've added another `public import` line to the module to ensure it actually works correctly when imported: ```D public import std.stdio; ``` Previously I had carelessly omitted this because I was using `trace.d` only in contexts where `std.stdio` had alrea