ul_utdefs

Pavel Pisa ppisa4lists at pikron.com
Mon Sep 8 00:01:19 UTC 2014


Hello all,

On Sunday 07 of September 2014 23:27:45 Jan Engelhardt wrote:
> (Gah, I already deleted the mail and then had the idea to fix up
> const_cast... do Cc the others!)
>
>
> const_cast can be used outside of functions too. I have changed the
> definition of const_cast* in libHX git now such that this works as well.

there is update of libHx from Jan Engelhardt

git://git.code.sf.net/p/libhx/libhx

http://sourceforge.net/p/libhx/libhx/ci/master/tree/include/libHX/defs.h#l93

It is simpler (does not need __builtin_choose_expr which can be problematic
on some old GCC where I have noticed some bug report exists).
On the other hand error message would not be so self explanatory.

The trick with +0 is clever and newer C standard allows it even for void*.

I have tried something similar to overcome comma operator not allowed
in initializers. I put my previous attempt there, because there can
be place to use that for some non pointers casting

  (typeof((typeof(new_type[1])){0}[0]))

This madness is equivalent to (new_type) but allows to place test [1-2*!!test]
onto [1] position to cause build time error.

Best wishes,

               Pavel



More information about the devel mailing list