[Issue 24793] Allow implicit conversion of const pointers to void*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 21 12:13:09 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24793

--- Comment #5 from Dennis <dkorpel at live.nl> ---
(In reply to Jonathan M Davis from comment #4)
> And right now, the assumption that the void*
> pointed to mutable data would be correct

It seems your whole argument is based on the premise that a function like this
could exist:

```
void somehowMutateP(void* p) @trusted;
```

Unless that function checks the validity of `p` at runtime, that's not a safe
interface. You cannot statically assume a void* points to something mutable, or
that it even is a pointer at all: It can also be an integer or handle, like
`PTHREAD_CANCELED = cast(void*) -1` or the result of `CreateSemaphoreW(...)`.

--


More information about the Digitalmars-d-bugs mailing list