On Tuesday, 19 September 2023 at 06:33:25 UTC, Richard (Rikki)
Andrew Cattermole wrote:
I assume what you are wanting is to get the alignment for a
given type?
https://dlang.org/spec/property.html#alignof
If instead you want the offset of a given field that's
different.
``T.field.offsetof``
On Tuesday, 19 September 2023 at 00:34:01 UTC, vino wrote:
Hi All,
I am trying to understand as to why the below code is throwing
error
Code
```
import std.stdio: writeln;
import std.container.array;
void main () {
//auto a = Array!string("Aname"); // throws error
auto b = Array
I assume what you are wanting is to get the alignment for a given type?
https://dlang.org/spec/property.html#alignof
If instead you want the offset of a given field that's different.
``T.field.offsetof``
https://dlang.org/spec/struct.html#struct_field_properties
Note: alignment cannot be repr
On Tuesday, 19 September 2023 at 03:53:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
There are no operators for this, not that you need one.
```d
void func(int numerator, int denominator, out int quotient, out
int remainder) {
quotient = numerator / denominator;
remainder = numerato
There are no operators for this, not that you need one.
```d
void func(int numerator, int denominator, out int quotient, out int
remainder) {
quotient = numerator / denominator;
remainder = numerator % denominator;
}
```
This will produce with ldc2 -O3:
```
void example.func(int, int,
On Tuesday, 19 September 2023 at 03:44:18 UTC, Vitaliy Fadeev
wrote:
What D function or D operator does this?
```asm
IDIV EAX, r/m32
```
```
IDIV 5, 2
EAX = 2
EDX = 1
```
and returns (2,1) at once?
You can either use function `out` parameters with return value or
`tuples`:
```D
import st
What D function or D operator does this?
```asm
IDIV EAX, r/m32
```
```
IDIV 5, 2
EAX = 2
EDX = 1
```
and returns (2,1) at once?
Hi All,
I am trying to understand as to why the below code is throwing
error
Code
```
import std.stdio: writeln;
import std.container.array;
void main () {
//auto a = Array!string("Aname"); // throws error
auto b = Array!char("Bname");// works
auto c = Array!stri
one of the overloads of template
'core.stdc.stdarg.va_arg' are callable using argument types
'!()(__va_list_tag[1], TypeInfo, int*)'
11 | va_arg(_argptr, typeid(i), &i);
|^
/opt/compiler-explorer/gcc-trunk-20230918/lib/gcc/x86_64-linux-gnu/14.0.0/include/