IBM Support

CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes becomes nonfunctional for attributes if set to False above in hierarchy

Technote (troubleshooting)


Problem(Abstract)

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:

  1. 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.
  2. Create two static attributes m_first and m_second.
  3. For m_first, please set the property "CPP_CG:Attribute:EnableInitializationStyleForStaticAttributes" to true and the property "CPP_CG:Attribute:InitializationStyle" to "ByInitializer".
  4. 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.


Document information

More support for: Rational Rhapsody
General Information

Software version: 7.5.1

Operating system(s): Windows

Reference #: 1421127

Modified date: 27 October 2010