Ticket #244 (new defect)
Opened 8 years ago
Access restrictions for "const" variables are too tight
| Reported by: | hauma | Owned by: | hauma |
|---|---|---|---|
| Priority: | normal | Milestone: | JPlater |
| Component: | JP trafo | Version: | 1.07i |
| Severity: | normal | Keywords: | |
| Cc: |
Description
In ticket:118, replicated static constants of remote classes were introduced. To enable constants of array type, the unused "const" modifier was re-introduced to declare the whole (multi-dimensional) array to be constant. Access to arrays declared "const" is restricted to ensure that their values cannot be modified outside the static initializer. These restrictions completely forbid creating alias references to const arrays. This restriction is too tight. Instead, the const modifier should be usable for local variables as well. Aliasing a constant static array as local const variable is OK, since the compiler can track the further usage of such local variables and prevent modifications of them.
