On Thursday, 28 July 2022 at 23:08:15 UTC, frame wrote:
On Thursday, 28 July 2022 at 20:20:27 UTC, pascal111 wrote:
I retyped again some function of C library I made before, but
with D code:
It's a start but you need to learn.
Thanks!
I made the equivalent of my C library "collect":
https://github.com/pascal111-fra/D/blob/main/dcollect.d
- these functions can run into UB if you compile it without
bound checking enabled
You are right, but I'm still in the beginning to learn all
necessary concepts and features I need.
- when working with arrays or ranges it's better to use
unsigned integers or just use `size_t` which represents
unsigned integer for 32 or 64 bit. This avoids negative values
and enables the maxmium value which can be provided on the
plattform to access the highest element in the array.
I tried to use now "uint".
- It's sure advanced topic but you should start to check your
input from the beginning. Try what happens if you apply
negative numbers or invalid offsets ;-)
I don't know which client you are using but please have an eye
on proper format of your posts - see the "Markdown formatting"
or disable the Markdown option below your input.
I don't understand much the posting details of this forum.
https://forum.dlang.org/help#about