On 26.12.2011 23:52, Ingo Weinhold wrote:
BTW, searching the guidelines for details about casts, I noticed: "Use new-style casts (dynamic_cast, static_cast, const_cast, reinterpret_cast) over old-style." While I certainly agree that dynamic_cast should be used when necessary, also like the more explicit const_cast when casting a const away, and occasionally find myself using static_cast to down-cast between objects of different classes, I would claim that the rule does not match the general practice. Definitely not not mine at least. I use C style casts when casting from and to void* and between primitive types. Can we strike or amend the rule?
Makes certainly sense; I usually find the C-style cast to be better readable anyway.
Feel free to rewrite that rule a bit :-)Maybe just a "use dynamic_cast/const_cast where appropriate in favor of C-style casts".
Bye, Axel.