Hi, Right now, when assertions are enabled, using castNode() on a pointer to const triggers a warning for my compilers: warning: passing argument 2 of ‘castNodeImpl’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
which seems appropriate. Obviously we could easily suppress that just by adding an explicit cast into the castNode definition or to the caller. But it strikes me as a somewhat legitimate warning. On gcc etc we could fairly easily reformulate castNodeImpl() to not trigger the above warning, but we'd still cast constness away due to the return type cast. #ifdef USE_ASSERT_CHECKING ... #define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr)) #else #define castNode(_type_, nodeptr) ((_type_ *) (nodeptr)) #endif /* USE_ASSERT_CHECKING */ ISTM adding a castConstNode or castNodeConst would make sense? Greetings, Andres Freund