Path: utzoo!attcan!uunet!cs.utexas.edu!uwm.edu!rutgers!mit-eddie!mit-amt!peter From: peter@mit-amt.MEDIA.MIT.EDU (Peter Schroeder) Newsgroups: comp.lang.c++ Subject: the use of const Keywords: const Message-ID: <740@mit-amt.MEDIA.MIT.EDU> Date: 22 Sep 89 22:30:04 GMT Organization: MIT Media Lab, Cambridge, MA Lines: 16 Is it desirable from an efficiency point of view to use the const modifier wherever applicable? I find myself hardly using it, although many (most?) of my functions do not change any of their arguments. I am wondering whether the compiler (cfront) will actually generate "better" code if I give it these hints. I understand the implications of its use as far as protecting myself, but mostly functions are so small that I don't usually screw myself in this way (type checking). On the other hand it is a nice hint to see a declaration such as form(const char* ...) which tells me that a certain argument will not be changed by the function.... Any advice/thoughts on this matter? Peter peter@media-lab.media.mit.edu