3 ms·
It shouldn't be hard to hack one from clang. You want to adjust usages of http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html http://clang.llvm.org/doxyge
by Someone 11y ago
It shouldn't be hard to hack one from clang. You want to adjust usages of http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html.
I would keep the main code as is, and add code to generate an error after every call that creates a cast (hacking that code into the constructors should work, too, but given the constructor for an empty cast and the subclasses, that will lead to lower quality error messages).
I expect you will want to allow some/all implicit casts, explicit ones from and to void pointers, and downcasts from 'pointer to struct with first field of type t' to 'pointer to t'.
But most importantly: what class of programming errors are you thinking of? That class of error, IMO, either requires a daft programmer or horrendous source code that is full of casts.