Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Re: const member functions: why bother the programmer? Message-ID: <421@mole-end.UUCP> Date: 24 Jul 90 06:57:19 GMT References: <2026@kulcs.kulcs.uucp> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 22 In article <2026@kulcs.kulcs.uucp>, herman@kulcs.uucp (Herman Moons) writes: > Why does the C++ language demand that the programmer states which > member functions are const ?? This seems a job for the compiler, not > for the programmer (after all, the compiler checks whether a function is > really const if we specify it that way). > What really bothers me about const member functions is that one must provide > the compiler with information that he already knows. > Any opinions on this topic ?? Only that the programmer can write overloads based on the const-ness, and that this is sometimes a desirable thing to do. I'm not entirely happy with the meaning of const as applied to class types, since there is the (by now) too-often repeated question of whether the const shoud indicate that the object in memory is const or that the ``thing'' which it represents is const. No, I don't know the answer. -- (This man's opinions are his own.) From mole-end Mark Terribile