C++ Logo


Advanced search

Re: Casts from const object type to function pointer type

From: Myria <myriachan_at_[hidden]>
Date: Thu, 27 Apr 2023 15:36:40 -0700
On Thu, Apr 27, 2023 at 1:36 PM Julien Villemure-Fr├ęchette <
julien.villemure_at_[hidden]> wrote:

> Forgot to explain why casting from function pointer to non const object
> _should_ be okay. But while thinking about it, I noticed a loophole in my
> reasoning. Actually, the most sensible semantics would be to reject such a
> cast, as it makes it possible to cast away const on an object via a
> function pointer type.
What about C-style casts? (See one of my other mails in this thread for
how it's a C-style cast that ironically can't remove constness)

Received on 2023-04-27 22:36:53