Forbid needless pointer casts
kindouchoud
jeyak10528 at ailiking.com
Fri Dec 25 15:16:04 UTC 2020
On Thursday, 20 February 2020 at 11:31:17 UTC, FlameInHeart wrote:
> Hey,
>
> How about forbidding this:
>
> void foo(Monkey* m) {
> Monkey* m2 = cast(Monkey*) m;
> }
>
> Pointer casts are potentially nasty when refactoring and the
> needless ones are easy for the compiler to detect, and probably
> no-one will find objections to this change.
>
> Just an easy win, isn't it?
>
> (not going to write a DIP for this...)
Truly, this change would unnecessarily muddle some format code.
Composing a lot of additional rationale just to keep a format
from emanating innocuous no-operation code in certain conditions
is really excruciating by and by.
More information about the Digitalmars-d
mailing list