IBM Support

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

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:

  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.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5.1","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21421127