On Wednesday, 20 October 2021 at 04:14:37 UTC, Dave P. wrote:
I am confused on how casting structs works. According to point
9 of https://dlang.org/spec/expression.html#CastExpression:
Casting a value v to a struct S, when value is not a struct of
the same type, is equivalent to:
```d
S(v)
I am confused on how casting structs works. According to point 9
of https://dlang.org/spec/expression.html#CastExpression:
Casting a value v to a struct S, when value is not a struct of
the same type, is equivalent to:
```d
S(v)
```
However, the following program compiles and the resulting
On Saturday, 16 October 2021 at 19:39:14 UTC, Kostiantyn Tokar
wrote:
On Friday, 15 October 2021 at 17:22:52 UTC, Tejas wrote:
[...]
Now I get it. If this DIP will be accepted, I just have to
provide move constructor/assignment for my types and forwarding
would work. It sounds really great.
On Tuesday, 19 October 2021 at 17:06:35 UTC, Steven Schveighoffer
wrote:
On 10/19/21 12:49 PM, Dennis wrote:
On Tuesday, 19 October 2021 at 16:20:39 UTC, Charles Hixson
wrote:
core.exception.RangeError@source/freqs.d(32): Range violation
??:? _d_arrayboundsp [0x56041325a70d]
On 10/19/21 12:49 PM, Dennis wrote:
On Tuesday, 19 October 2021 at 16:20:39 UTC, Charles Hixson wrote:
core.exception.RangeError@source/freqs.d(32): Range violation
??:? _d_arrayboundsp [0x56041325a70d]
??:? _Dmain [0x560413233beb]
DMD64 D Compiler v2.097.2
By the way, if
Thank you. That seems to have solved the problem (bar additional
testing). And also thanks for your recommendation to add to the index
rather than casting the length. It wasn't as "nice" to my eyes at
first, but it's a cleaner answer.
On 10/19/21 9:38 AM, Adam D Ruppe via
On Tuesday, 19 October 2021 at 16:20:39 UTC, Charles Hixson wrote:
core.exception.RangeError@source/freqs.d(32): Range violation
??:? _d_arrayboundsp [0x56041325a70d]
??:? _Dmain [0x560413233beb]
DMD64 D Compiler v2.097.2
By the way, if you upgrade to 2.098.0, you get a
On Tuesday, 19 October 2021 at 16:38:50 UTC, Adam D Ruppe wrote:
test `i + 3 < line.length` instead
BTW this is my personal preference, I have gotten into the habit
of using this style tests with lengths all the time now.
On Tuesday, 19 October 2021 at 16:20:39 UTC, Charles Hixson wrote:
given this code fragment:
if (i < (line.length - 3) )
in c4: i = 0, line.length = 2
line.length is an unsigned value. Arithmetic on an unsigned thing
is still unsigned.
So UNSIGNED 2 - 3 is not -1, but
On Tue, Oct 19, 2021 at 09:20:39AM -0700, Charles Hixson via
Digitalmars-d-learn wrote:
> given this code fragment:
>
> if (i < (line.length - 3) )
> { writeln ("in c4: i = ", i, ", line.length = ",
> line.length);
> add2 (c4, line [i..i+4]);
> I
given this code fragment:
if (i < (line.length - 3) )
{ writeln ("in c4: i = ", i, ", line.length = ",
line.length);
add2 (c4, line [i..i+4]);
I get this result:
in c4: i = 0, line.length = 2
core.exception.RangeError@source/freqs.d(32): Range
11 matches
Mail list logo