[cfe-commits] [PATCH 11/15] Fix Casting

dag at cray.com dag at cray.com
Fri Jan 11 11:35:35 PST 2013


Argyrios Kyrtzidis <akyrtzi at gmail.com> writes:

>>> Hmm...I think const_cast is useful because it's a red flag.  I don't
>>> think we should be hiding that as it can indicate a design issue.
>> 
>> That's right, const_cast is a red flag, but in these places the cast
>> is always safe, since we are storing pointers to AST nodes (which are
>> always allocated non-const) into a C struct with void* pointer just to
>> pass the struct to C-land.
>
> One could argue the C struct should be "const void *" and const
> pointers should be used everywhere when casting it back; not sure if
> it is worth it.

I agree.

                                  -David



More information about the cfe-commits mailing list