Re: need help to get bitoffsetof bitwidth for clang

2024-07-03 Thread Tim via Digitalmars-d-learn
On Tuesday, 2 July 2024 at 05:34:19 UTC, Dakota wrote: I want to get `bitoffsetof` and `bitwidth` in clang, to verify the d memory layout. I try this but not work: ```c #define offsetof_bit(type, member) ((offsetof(type, member) * 8) + __builtin_ctz(((type *)0)->member)) ``` get this error

Re: Why does this mixin fail to compile?

2024-07-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 3 July 2024 at 11:57:58 UTC, Lance Bachmeier wrote: On Wednesday, 3 July 2024 at 03:52:41 UTC, Steven Schveighoffer wrote: And yes, it is faster to do this than appending. But you have to do a *lot* of it to make a huge difference. What about creating an array of strings and th

Re: Why does this mixin fail to compile?

2024-07-03 Thread Lance Bachmeier via Digitalmars-d-learn
On Wednesday, 3 July 2024 at 03:52:41 UTC, Steven Schveighoffer wrote: ```d mixin template implement() { mixin(() { // ctfe new array is basically the same as static array char[] buffer = new char[4096]; int pos = 0; void append(string str) {