On Tue, Aug 08, 2006 at 09:27:23PM +0200, Eric Pouech wrote:
what I don't like is that in order to plug a hole (casting from const foo* to foo*), we create a bigger hole by allowing to cast from const foo* to bar* (and the compiler will not give any warning) if we want to go into this, then I'd rather have _deconst explicitly use the type: #define __deconst(v,X) ({const X _v = (v); ((X)(int)_v);}) and in the previous example use __deconst(str, char*);
That isn't valid C, you could do: ((const X)(v) - (v), (X)(int)(v)) but that is likely to give a 'computed value not used' warning instead.
What you really don't want to do is allow casts from 'int' to 'foo *'. After all casting from 'foo *' to 'bar *' is easy.
David