[cfe-dev] GCC-specific, Clang-specific and ObjC-specific casts in C++

Daniel Dunbar daniel at zuster.org
Sat Jul 25 15:17:52 PDT 2009

On Sat, Jul 25, 2009 at 9:04 AM, Sebastian
Redl<sebastian.redl at getdesigned.at> wrote:
> Hi,
> I just committed a patch that does correct validation of C-style casts
> for C++. However, it is only correct as far as the standard is
> concerned. Clang does more. To implement this, however, I need information.
> ...
> 4) Are there formalized Objective-C semantics? Which casts are allowed,
> which are disallowed? Which are implicit, and which, in Objective-C++,
> should be allowed by static_cast and reinterpret_cast respectively?

Formalized, no. One general rule of thumb is that interface behave
like pointers to structs, since this is historically their
implementation. Of course, that doesn't always make a lot of sense so
its mostly a good rule of thumb for what gcc will do, not what is
necessarily best.

 - Daniel

More information about the cfe-dev mailing list