Some user-made C functions and their D equivalents
frame
frame86 at live.com
Thu Jul 28 23:08:15 UTC 2022
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.
- these functions can run into UB if you compile it without bound
checking enabled
- 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.
- 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.
https://forum.dlang.org/help#about
More information about the Digitalmars-d-learn
mailing list