Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mtnmath!paul From: paul@mtnmath.UUCP (paul) Newsgroups: comp.lang.c++ Subject: Need `set before used' warning Keywords: c++, warning Message-ID: <2@mtnmath.UUCP> Date: 26 Sep 90 18:36:31 GMT Organization: Mountain Math Software, P. O. Box 2124, Saratoga, CA 95070 Lines: 30 The following code is compiled by HCR's (SCO Canada) and Comeau's C++ compilers without a whimper. (These are ports of AT&T's code versions 2.0 and 2.1 respectively.) class Example { char * Point ; public: Example(char * point) {point=Point;} }; There are two errors that it would be helpful to flag with warning messages. 1. Member variable `Point' is used before it is set. 2. Constructor parameter `point' which is not a reference is set before it is used. The latter message could apply to any subroutine definition, while the former is only valid for constructors. Is there some reason warnings of this sort should not be given? If not it would be a helpful addition for those of us who are slightly dislexix and make the above error with infrequent but painful regularity. Paul Budnik Mountain Math Software (408) 353-3989 uunet!mtnmath!paul