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

Reply via email to