At Tue, 03 Nov 2009 12:45:49 -0700, Gerard Jungman wrote: > Actually, it endorses a "C" practice. It's "bad"-ness is > a theological issue. See the attached paper by Siff et AL.,
Ok, I have read the paper now. I do think the practice of casting described there is rather dated. When people had no viable alternative to C, they had to resort to such tricks. It is not something that should be encouraged today -- programs should either be written safely, following the rules of type-checking in C, or be written in another language. Our approach is actually described in the paper under the "first member" section, in the &(cp.p) example -- although they don't point out that it's the only one that doesn't require a cast and can be checked by the compiler, unlike all the others. > There are other ways to design containers. Some ways > involve radical change to the GSL container methodology. > For example, the const-ness of the data pointer could be > explicitly divorced from the layout meta-data which constitutes > the rest of the container. That is more interesting theoretically. From a practical point of view, I think we have to restrict ourselves to solutions where the data pointer and the metadata are a single object though. -- Brian Gough
