Troubleshooting
Problem
CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes becomes nonfunctional for attributes if set to False above in hierarchy in IBM Rational Rhapsody.
Symptom
Wrong generation of code which results from the fact that we are unable to override the property "CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes" at the attribute level.
Cause
This has been identified and logged as a APAR ID: PM07674.
Diagnosing The Problem
If the value of the property "CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes" is set to True,
then the code for initializing static attributes is based on the value of the property "InitializationStyle".
If the value of this property is set to False, then the value of the property "InitializationStyle" will have no effect on the initialization of static attributes. Rather, the initialization of static attributes will always be by assignment in this case.
However, it has been observed that If this property has been set to "False" at a higher hierarchy such as a profile,then setting the property at the attribute level has no effect.
Steps to reproduce the problem:
- Create an IBM Rational Rhapsody model which has a profile named "SampleProf"
Set the property "CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes" to False so that this is applied globally. - Create two static attributes m_first and m_second.
- For m_first, please set the property "CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes" to true and the property "CPP_CG:Attribute:InitializationStyle" to "ByInitializer".
- Generate code.
Code is generated as
int SampleClass::m_first = 1; // Rhapsody generated code
instead of overriding the property and generating the correct code as:
int SampleClass::m_first(1) // Rhapsody generated code
Resolving The Problem
Currently, the only known workaround is to set the property "CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes" to true at the profile level and then override the attribute properties wherever required.
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21421127