void foo(const int * const p) { *(int*)p = 3; // UB? So sue me! }
I.e. it serves no purpose, other than documentation. Let's try it in D:
@safe void foo(const int *p) { *cast(int*)p = 3; } Error: cast from const(int*) to int* not allowed in safe code
> I.e. it serves no purpose, other than documentation Yeah, agreed.
[0] https://gcc.godbolt.org/z/v4qYME8fP
I.e. it serves no purpose, other than documentation. Let's try it in D: