mixin template's alias parameter ... ignored ?
Ali Çehreli
acehreli at yahoo.com
Mon Jul 12 23:25:13 UTC 2021
On 7/12/21 3:35 PM, someone wrote:
>>> private size_t pintSequenceCurrent = cast(size_t) 0;
>
>> Style: There's no need for the casts (throughout).
>
> [...] besides, it won't hurt, and it helps me in many ways.
I think you are doing it only for literal values but in general, casts
can be very cumbersome and harmful.
For example, if we change the parameter from 'int' to 'long', the cast
in the function body is a bug to be chased and fixed:
// Used to be 'int arg'
void foo(long arg) {
// ...
auto a = cast(int)arg; // BUG?
// ...
}
void main() {
foo(long.max);
}
Ali
More information about the Digitalmars-d-learn
mailing list