On Wednesday, 30 November 2022 at 03:07:44 UTC, thebluepandabear
wrote:
I am curious as to what formula the D compiler uses for
calculating 'overflowed' values, if such thing exists? :)
Regards,
thebluepandabear
**Source:**
http://ddili.org/ders/d.en/cast.html?#ix_cast.arithmetic%20convers
On Wednesday, 30 November 2022 at 03:19:49 UTC, Basile B. wrote:
writeln((30LU + 30LU) % uint.max);
It's actually
writeln((30LU + 30LU) % (uint.max.to!ulong +
1));
or
writeln((30LU + 30LU) & uint.max);
On Wednesday, 30 November 2022 at 03:19:49 UTC, Basile B. wrote:
[...]
It's always a wraparound (think modulo) but your examples with
negative number can be explained because there are hidden
unsigned to signed implicit convertions.
That the only special things D does.
forgot to say, you can
On Wednesday, 30 November 2022 at 03:07:44 UTC, thebluepandabear
wrote:
I am reading through Ali's book about D, and he gives the
following examples for an overflow:
```D
import std.stdio;
void main() {
// 3 billion each
uint number_1 = 30;
uint number_2 = 30;
}
writeln("maximum
I am reading through Ali's book about D, and he gives the
following examples for an overflow:
```D
import std.stdio;
void main() {
// 3 billion each
uint number_1 = 30;
uint number_2 = 30;
}
writeln("maximum value of uint: ", uint.max);
writeln("
number_1: ", number_1);
writeln(
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote:
To me, it appears that there are really two (_entirely
separate_) concepts:
A. Supporting the useful concept of variable length (but
otherwise entirely conventional) arrays;
B. Supporting a language feature that acts as a window to
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote:
To me, it appears that there are really two (_entirely
separate_) concepts:
A. Supporting the useful concept of variable length (but
otherwise entirely conventional) arrays;
B. Supporting a language feature that acts as a window to
On Wednesday, 30 November 2022 at 01:17:14 UTC, zjh wrote:
Should there be an `intermediate layer` to simplify such
function calls?
There should be a `placeholder` similar to `inout` that can
absorb all `attributes` of the parameter.
On Wednesday, 30 November 2022 at 01:53:10 UTC, Siarhei Siamashka
wrote:
Rust also appears to be picky about the order of operations:
```Rust
fn main() {
let mut a = [1, 2, 3, 4, 5];
let c = a;
let b = &mut a;
b[1] = 99;
println!("{:?}", b); // [1, 99, 3, 4, 5]
print
On Wednesday, 30 November 2022 at 00:40:57 UTC, Vladimir
Panteleev wrote:
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote:
Suggestion: it would be clearer if the two concepts were
separated:
1. Convert 'int[] VarArr;' so it produces a straightforward
_value-type_ variable array, ca
On Wednesday, 30 November 2022 at 01:30:03 UTC, Steven
Schveighoffer wrote:
On 11/29/22 7:50 PM, WebFreak001 wrote:
(note: I don't want to use a template, this way of writing it
has the advantage that the compiler checks all different code
paths for errors, so the errors aren't delayed until s
On 11/29/22 7:50 PM, WebFreak001 wrote:
(note: I don't want to use a template, this way of writing it has the
advantage that the compiler checks all different code paths for errors,
so the errors aren't delayed until someone actually tries to iterate
over my data structure)
1. use the templa
On Wednesday, 30 November 2022 at 00:50:46 UTC, WebFreak001 wrote:
...
Should there be an `intermediate layer` to simplify such function
calls?
On Thursday, 10 November 2022 at 21:27:28 UTC, Ali Çehreli wrote:
However, ftw performs about twice as fast as dirEntries
Yes, `dirEntries` isn't as fast as it could be.
Here is a directory iterator which tries to strictly not do more
work than what it must:
https://github.com/CyberShadow/a
On Tuesday, 29 November 2022 at 23:25:46 UTC, DLearner wrote:
Many languages also have variable length arrays, I suggest D's
'dynamic array' _does not_ operate as expected.
I'm not suggesting that the result contradicts D's definition
of 'dynamic array', nor it's implementation, just that 'dynam
note: all of these functions are prefixed with `scope:`
it seems now when trying to cover scope semantics, @safe/@system
and pure it already becomes quite unmanagable to implement
opApply properly.
Right now this is my solution:
```d
private static enum opApplyImpl = q{
int result;
foreach (string key, ref value; this.table) {
result =
On Wednesday, 30 November 2022 at 00:40:57 UTC, Vladimir
Panteleev wrote:
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote:
Suggestion: it would be clearer if the two concepts were
separated:
1. Convert 'int[] VarArr;' so it produces a straightforward
_value-type_ variable array, ca
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote:
Suggestion: it would be clearer if the two concepts were
separated:
1. Convert 'int[] VarArr;' so it produces a straightforward
_value-type_ variable array, called 'VarArr';
2. Implement a new concept 'int slice Window;' to produce an
On Tuesday, 29 November 2022 at 23:25:46 UTC, DLearner wrote:
On Tuesday, 29 November 2022 at 19:06:20 UTC, rikki cattermole
wrote:
[...]
Please see the following example:
...
I think this was discussed before a few weeks ago here (But I
don't remember the thread), and this is a design choic
On Tuesday, 29 November 2022 at 19:06:20 UTC, rikki cattermole
wrote:
[...]
Please see the following example:
```
void main() {
import std.stdio;
int[] VarArr1, VarArr2;
VarArr1.length = 6;
VarArr1[5] = 10;
VarArr1[4] = 9;
VarArr1[3] = 8;
VarArr1[2] = 7;
VarArr1[1] = 6
On Tuesday, 29 November 2022 at 00:50:54 UTC, Paul Backus wrote:
If your goal is to avoid calling the copy constructor (and, I
assume, to avoid unnecessary instantiations of `move`), then
yeah, `isPOD` is the one you want.
Thanks.
Okay you have misunderstand a lot here.
We have two types of arrays:
- Static, fixed sized stored on stack.
- Dynamic, variable sized, stored on the heap.
However dynamic arrays are not actually a distinct type in the type
system, its a language extension to use runtime hooks using the GC.
W
To me, it appears that there are really two (_entirely separate_)
concepts:
A. Supporting the useful concept of variable length (but
otherwise entirely conventional) arrays;
B. Supporting a language feature that acts as a window to an
array, through which that array can be manipulated.
And c
On Tuesday, 29 November 2022 at 07:17:09 UTC, Joel wrote:
On Saturday, 30 November 2019 at 00:17:51 UTC, Mike Wey wrote:
On 29-11-2019 04:40, Joel wrote:
Oh, I used 'brew install gtk+3', and the test program worked,
but (see below) I don't know about all that installing - is
that alright?
Th
On Tuesday, 29 November 2022 at 07:17:09 UTC, Joel wrote:
On Saturday, 30 November 2019 at 00:17:51 UTC, Mike Wey wrote:
On 29-11-2019 04:40, Joel wrote:
Oh, I used 'brew install gtk+3', and the test program worked,
but (see below) I don't know about all that installing - is
that alright?
Th
26 matches
Mail list logo