Article View: comp.std.c++
Article #3628Re: 'const' in header files
From: Tom Payne
Date: Sat, 09 Mar 1996 04:37
Date: Sat, 09 Mar 1996 04:37
25 lines
1952 bytes
1952 bytes
Lars Farm (lars.farm@nts.mh.se) wrote: : : Experts explained that this is as it should be for const float, but not for : const int (I know that the std does not talk about warnings). The point is: : The experts seems to find some kind of conceptual difference between named : constant floats and named constant ints, such that declaring const int K = : L; in a header is considered good practice but const float X = Y; in a : header is not and justifies a warning. I don't think there should be any : such difference. In fact, there is no such difference, as I understand it, in the way the standard treats float and int in this regard. Unused-variable warnings (a quality-of-implementation matter) are often less than helpful, e.g., I get such a warning every time I acquire mutual exclusion by creating an object whose constructor acquires the lock and whose destructor releases it, since the object is not accessed elsewhere. Tom Payne (thp@cs.ucr.edu) --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<4hpseb$ld6@galaxy.ucr.edu>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<AD5A0C5196681CA0D@sleipner.nts.mh.se>Show Full Headers
Complete Article Headers
From: thp@cs.ucr.edu (Tom Payne) Message-ID: <4hpseb$ld6@galaxy.ucr.edu> X-Original-Date: 8 Mar 1996 17:57:31 GMT Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 09 Mar 96 04:37:06 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Subject: Re: 'const' in header files Organization: University of California, Riverside References: <AD5A0C5196681CA0D@sleipner.nts.mh.se> X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMUELQuEDnX0m9pzZAQFd/AGAmnmmpsNO0fSZVDUy4bp+O4cslbweEkOr 4nwfEAIX7qUwP6hC5voahp6JUTfZj7Uh =c4c/