Hi Steve, On Fri, 24 Aug 2001 13:37:37 -0500 "Stephen J. Sanders" <ssanders@ku.edu> wrote concerning "Please check constness!": > Hi, > I have a request for the developers. Could you please check your > compilations for warnings concerning bad const usage. On the piis > things are apparently set up so that you can get away with this. Unfortunately, not everyone is as fortunate as you and have a fairly new compiler. The GCC (2.91.66) on Redhat 6.2 (the one on most pii's [1] and rcas) does not implement all of the ANSI/ISO [2,3] standard, and therefor people using that compiler solely, will not see some of these warnings. The reason why some of us are stuck with older releases of GCC are legion: BOFHs [4], lazyness, it's the compiler on rcas (and rcrs), don't want to use "GCC 2.96" [5], and so on. Therefor, have patience. Be aware, that most people do not have the privilege of choosing thier system. We must count on the rare individual to help us out with these things (yes, that includes you Steve). An aside: When I have the time (which is scarce at the moment), I'll make an option for the configure script, that will make the compilation extremly strict. If someone wants to give it a shot, please, be my guest (see [6]). > Although, I'm not sure why one would want to make a const > declaration that is ignored by the compiler This, as outlined above, is not a conscious choice made by the pii SysOp. It's due to the machines having a similar setup to that you'll find on rcas and rcrs. > The problem is that there are other systems that return an error > status and the bad usage prevents compilation. This is the reason you should _always_ make your code as ANSI/ISO standard as possible, and never ever use compiler "features". This is the reason for standards per se (which some OS vendors to not give a fart about). The moral of this: Get the ANSI/ISO C++ standard, and if you're in doubt, look it up. > This is a particular problem with the BrNtuplex.cxx code. I'm > cleaning this up so that I can compile the code locally, but in some > cases I'm not sure that I am making the correct assumption as to > whether one should remove the const, or include it in the base > function definition. As I said above, we have to count on the rare individuals to do the cleanup. I'm sorry, but there you have it. And if you're in doubt, look it up in the ANSI/ISO C++ standard. A short note: If your class returns a reference to a member, and the method that returns that member is const, then the object is const in the context of the message call, and therefor the member is const in that message: So the method _must_ return a const reference. Thanks for understanding and you patience. Yours, Christian Holm Christensen ------------------------------------------- Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 DK-2200 Copenhagen N Cell: (+45) 28 82 16 23 Denmark Office: (+45) 353 25 305 Email: cholm@nbi.dk Web: www.nbi.dk/~cholm [1] http://pii3.brahms.bnl.gov/~olchansk/cluster/config.html [2] Order ($18.00) from http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998 [3] Bjarne Stroustroup's page: http://www.research.att.com/~bs/3rd.html [4] Bastard Operator From Hell. See http://bofh.ntk.net/Bastard.html (it's a scream). [5] Version 2.96 of GCC, as shipped by Redhat, does not exist. See also http://gcc.gnu.org/ml/gcc-announce/2000/msg00003.html (that is far from being funny) [6] http://sources.redhat.com/autobook
This archive was generated by hypermail 2b30 : Fri Aug 24 2001 - 15:22:08 EDT