Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: Initialization of object attributes
Topic Summary:
Created On: 26-Oct-2006 10:49
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 26-Oct-2006 10:49
User is offline View Users Profile Print this message


Stefan Moock

Posts: 2
Joined: 26-Oct-2006

Hi,

I am using Rhapsody 7.0MR1 for C++.
1. Define e.g. a class A with an attribute "int x"
2. Define an object a:A
3. Specify in the attributes-tab of the object-features not only an initial value for x (e.g. 0, class relevant), but also a "value" (e.g. 42, only for the object a).
The initialization of a.x with 42 is not generated in the code anywhere !
a.x always contains the initial value or - if omitted - anything (from the heap).
Is it a bug or do I have set some properties to get the value-assignment generated ?

Thanks in advance, Stefan
Report this to a Moderator Report this to a Moderator
 27-Oct-2006 21:51
User is offline View Users Profile Print this message


Jan Diep

Posts: 18
Joined: 31-May-2005

Are you sure? cuz it always generates the code for me. The code will be generated in the class.cpp file, in the format

ClassA::ClassA() : x(0)
{
}

The location of that code can be changed by flipping the preference option CPP_CG::Attribute::InitializationStyle from ByInitializer to ByAssignment. Then you'll get the code

ClassA::ClassA
{
x = 0;
}

You are setting the "Initial Value" field in the attribute right?
Report this to a Moderator Report this to a Moderator
 28-Oct-2006 16:47
User is offline View Users Profile Print this message


Stefan Moock

Posts: 2
Joined: 26-Oct-2006

Hi Jan,

what you have described is the initial value for a member of the class if instanciated and this works well - as you wrote ;-)
But if you have an object (e.g. take class an say 'make an object'), you will see an additional column called 'value' (beneath the 'initial value' column) in the object features (tab attributes). If you enter values for the particular object here, it has no effect at all although it is described different in the manual.

Best regards,
Stefan
Report this to a Moderator Report this to a Moderator
 1-Feb-2008 15:39
User is offline View Users Profile Print this message


Garrett Wampole

Posts: 7
Joined: 30-Jan-2008

I have noticed this same behavior...has there been any resolution?
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.