The Constants and Enums window lets you do a constant analysis. You can access this window via the View menu.

| All constants and Enums | List all constants and enumeration constants in the system. |
|---|---|
| Duplicate names | List all the cases where 2 or more constants/enum constants share the same name. |
| Duplicate values | List all the cases where 2 or more constants/enum constants share the same value. Use this option to search for constants to join together. Defining a constant value at just one location is good for both reuse and prevention of errors. When you need to change the value, you only need to do it once. |
| Duplicate name+value | List all the cases where 2 or more constants/enum constants share the same name and value. You should remove the duplicates if possible. |
| Same name, different value | List all the cases where 2 or more constants/enum constants share the same name but have a different value. These are potential errors. Why do they have a different value? Is it by design or by error? Even if the code is correct now, having several different values is likely to confuse developers later. Consider renaming the constants. Right-click the one you want to rename to get a list of references. After renaming, remember to rewrite each of the use locations as well, otherwise your code will not function the way it did before. |
| List all the cases where 2 or more different constants/enum constants share the same value. This list may reveal constants that have been defined several times with (slightly) differing names. As described above, defining each constant at just one location is better. |
The toolbar buttons let you access more features. You can also access these features by right-clicking the list.
PI=3.14159265358979 rather than PI=3.14. Even if the program doesn't need all the decimals right now, reusing an inaccurate value may lead to problems later. An inaccurate or incorrect constant value may be hard to detect.©Aivosto Oy - Project Analyzer Help Contents