Watch, Follow, &
Connect with Us
Public Report
Report From: C++BuilderX/Compiler    [ Add a report in this area ]  
Report #:  6693   Status: Reported
constant reported as unused
Project:  C++BuilderX/BC++ 2005 Build #:  1786
Version:    1.0 Submitted By:   Geoff Worboys
Report Type:  Issue Date Reported:  12/22/2003 5:05:57 PM
Severity:    Commonly encountered problem Last Updated:
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: None
The BC 5.6 compiler reports (some?) constants as unused when they are obviously being used.

For example the demonstration code given in "steps to reproduce" when compiled with warnings on reports:

Warning W8080 bug_test.cpp 54: 'const_int' is declared but never used in function main(int,char * *)

The code compiles and functions OK, but the unnecessary warning is both misleading and wrong.
Steps to Reproduce:
int main(int, char**)
    const int const_int = 512;
    std::cout << "Used constant bug:\n    "
        << const_int;
remove the "const", use a macro, turn off warnings.

None of which are satisfactory or appropriate to good C++ code.


Server Response from: ETNACODE01