On Tuesday, 28 July 2020 at 11:04:00 UTC, Cecil Ward wrote:
Of course, in C I used to do something like strong typing with
an opaque type achieved by using something like typedef struct
_something {} * type1; and then I had to do casting to get back
the real type, which was unchecked but it did
I just remembered: another favourite bug of mine would be mixing
up indices, using an index with the wrong array, an index to a
different array entirely. they’re all just a nightmare load of
meaningless ints or uints or hopefully size_t’s.
Of course, in C I used to do something like strong typing with an
opaque type achieved by using something like typedef struct
_something {} * type1; and then I had to do casting to get back
the real type, which was unchecked but it did prevent the user
from mixing up the types type1 and type2 s
On Tuesday, 28 July 2020 at 07:16:53 UTC, Petar Kirov
[ZombineDev] wrote:
On Tuesday, 28 July 2020 at 04:40:33 UTC, Cecil Ward wrote:
[snip]
By the way, I found 2 implementations of unit of measurement in
D:
https://code.dlang.org/packages/units-d
https://code.dlang.org/packages/quantities
On Tuesday, 28 July 2020 at 04:40:33 UTC, Cecil Ward wrote:
[snip]
By the way, I found 2 implementations of unit of measurement in D:
https://code.dlang.org/packages/units-d
https://code.dlang.org/packages/quantities
On Tuesday, 28 July 2020 at 04:40:33 UTC, Cecil Ward wrote:
I found an earlier post somewhere about work someone has done
on physical units such as kg, volts and so forth.
It would be very good to catch bugs such as
volts_t v = input_current;
[...]
This is easily done and uses enums: (o
I found an earlier post somewhere about work someone has done on
physical units such as kg, volts and so forth.
It would be very good to catch bugs such as
volts_t v = input_current;
But that isn’t nearly enough. With strong typing where we can
create arbitrary subtypes that are chosen to