On Tuesday, 23 January 2024 at 23:40:55 UTC, Danilo wrote:
How did you make it correct?
Write 2 different versions for `signed` and `unsigned` types?
Or could you utilize `core.checkedint` somehow for checking
overflow?
```d
double value(T)(T index, double * x) {
bool overflow;
subu(i
On Tuesday, 23 January 2024 at 23:40:55 UTC, Danilo wrote:
On Tuesday, 23 January 2024 at 17:54:25 UTC, bachmeier wrote:
Here's a reduced version of one of the most bizarre bugs I've
dealt with in any language. The only reason I didn't move on
to another language was because I was too busy at t
On Tuesday, 23 January 2024 at 21:40:46 UTC, Renato wrote:
While I can understand your frustration, it seems to me D is
not to blame in this instance because the code is quite
patently using unsafe constructs (D does not claim to be fully
safe).
It pretends to be safe. Consider this:
```
vo
On Tuesday, 23 January 2024 at 17:54:25 UTC, bachmeier wrote:
Here's a reduced version of one of the most bizarre bugs I've
dealt with in any language. The only reason I didn't move on to
another language was because I was too busy at the time.
The code allows for initial values if the index i
On Tuesday, 23 January 2024 at 18:15:29 UTC, Stephen Tashiro
wrote:
If the constructor of a class needs to create an array of
structs whose dimensions are inputs, what's the syntax for
doing this?
For a non-example, the following program errors in main()
because in t.array[][] "index [0] is o
On Tuesday, 23 January 2024 at 21:40:46 UTC, Renato wrote:
While I can understand your frustration, it seems to me D is
not to blame in this instance because the code is quite
patently using unsafe constructs
I wouldn't blame bachmeier, because many reduced testcases
distilled from the real c
On Tuesday, 23 January 2024 at 21:18:53 UTC, bachmeier wrote:
There are two things things that cause the problem. One is the
use of a template and the other is passing an unsigned type.
The reason the first parameter uses a template is because there
are a lot of types I could send as the first
On Tuesday, 23 January 2024 at 19:27:26 UTC, Renato wrote:
Here's a reduced version of one of the most bizarre bugs I've
dealt with in any language. The only reason I didn't move on
to another language was because I was too busy at the time.
The code allows for initial values if the index is l
On Tuesday, 23 January 2024 at 19:32:31 UTC, Stephen Tashiro
wrote:
Thank you.
I don't really understand what the syntax
new Point[][](the_dimension,the_dimension);
denotes. Does it represent a function? To look up this topic,
what are the proper keywords?
By experimentation, I found tha
On Tuesday, January 23, 2024 12:32:31 PM MST Stephen Tashiro via Digitalmars-
d-learn wrote:
> On Tuesday, 23 January 2024 at 18:23:22 UTC, Renato wrote:
> > This works , your mistake was to not actually assign the array
> > to the class' field!
> >
> > Change this line:
> >
> > ```d
> > auto array
On Tuesday, 23 January 2024 at 18:23:22 UTC, Renato wrote:
This works , your mistake was to not actually assign the array
to the class' field!
Change this line:
```d
auto array = new Point[][](the_dimension,the_dimension);
```
To this:
```d
this.array = new Point[][](the_dimension,the_dimens
On Tuesday, 23 January 2024 at 17:54:25 UTC, bachmeier wrote:
On Tuesday, 23 January 2024 at 12:34:38 UTC, Nick Treleaven
wrote:
But I'm strongly in favour of catching any bugs at
compile-time (and have been since before I discovered D). I
just object to anyone trying to downgrade the importa
On Tuesday, 23 January 2024 at 18:15:29 UTC, Stephen Tashiro
wrote:
If the constructor of a class needs to create an array of
structs whose dimensions are inputs, what's the syntax for
doing this?
For a non-example, the following program errors in main()
because in t.array[][] "index [0] is o
If the constructor of a class needs to create an array of structs
whose dimensions are inputs, what's the syntax for doing this?
For a non-example, the following program errors in main() because
in t.array[][] "index [0] is out of bounds".
import std.stdio;
struct Point
{
uint
On Tuesday, 23 January 2024 at 12:34:38 UTC, Nick Treleaven wrote:
But I'm strongly in favour of catching any bugs at compile-time
(and have been since before I discovered D). I just object to
anyone trying to downgrade the importance of automated
memory-safety checking.
I'm not downgrading
On Tuesday, 23 January 2024 at 17:22:25 UTC, Paul Backus wrote:
On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote:
It works fine.. but when the variable becomes ``const(Stuff)*
stuff;``
It gives me:
```
onlineapp.d(13): Error: cannot uniquely infer `foreach`
argument types
```
I h
On Tuesday, 23 January 2024 at 17:07:18 UTC, Alexandru Ermicioi
wrote:
On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote:
Hello,
I have the following:
```D
struct Stuff {
int opApply(scope int delegate(Stuff*) dg)
{
return 0;
}
};
void main()
{
Stuff* stuff;
On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote:
It works fine.. but when the variable becomes ``const(Stuff)*
stuff;``
It gives me:
```
onlineapp.d(13): Error: cannot uniquely infer `foreach`
argument types
```
I have no idea what i should be doing, does anyone have a clue?
ht
On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote:
Hello,
I have the following:
```D
struct Stuff {
int opApply(scope int delegate(Stuff*) dg)
{
return 0;
}
};
void main()
{
Stuff* stuff;
foreach(it; *stuff)
{}
}
```
It works fine.. but when the varia
Hello,
I have the following:
```D
struct Stuff {
int opApply(scope int delegate(Stuff*) dg)
{
return 0;
}
};
void main()
{
Stuff* stuff;
foreach(it; *stuff)
{}
}
```
It works fine.. but when the variable becomes ``const(Stuff)*
stuff;``
It gives me:
```
onl
On Monday, 22 January 2024 at 19:49:19 UTC, Siarhei Siamashka
wrote:
The two's complement wraparound behavior mandated by the D
language spec is a non-technical political decision, intended
to make life easier for the DMD compiler developers, but
ignoring the needs of the users.
Actually it i
On Monday, 22 January 2024 at 19:11:50 UTC, Siarhei Siamashka
wrote:
On Monday, 22 January 2024 at 16:39:10 UTC, Nick Treleaven
wrote:
Memory safety issues are a worse class of bug than arithmetic
bugs. The latter are reproducible if you feed them the same
input.
Memory safety bugs are reprod
22 matches
Mail list logo