From: Jorgen Grahn on 22 Jul 2010 07:41 ["Followup-To:" header set to comp.lang.c++ -- again.] On Tue, 2010-07-20, Peter Duniho wrote: > Christian Hackl wrote: >> Peter Duniho ha scritto: >> >>> But C++ has it a bit worse, because "const" is not required even where >>> applicable (never mind that it wasn't even around or in common use >>> when a lot of the APIs that C/C++ programs use were created). So you >>> could be in a context where "const" has been applied, you want to call >>> something that is still within the spirit of "const", but you have to >>> cast the "const" away because the thing you want to call didn't use >>> "const". >> >> Maybe I'm just lucky, but I cannot even remember the last time I >> actually had to use const_cast because of some broken (or legacy) C++ or >> C API. How often do you really encounter this problem? > > I have successfully avoided using C++ to any significant extent for > nearly a decade. In the 90's, it came up on a regular enough basis to > dissuade me from making more than a half-hearted attempt to "const"-ify > my code. > > Maybe it's not as big of a problem as it used to be. Lots have happened since the 1990s. Quality APIs (C and C++) use const today. (At least on Unix, where I do my work.) /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o .
|
Pages: 1 Prev: Activating JMX, tomcat5 and Java1.6 Next: Best way to do this? |