Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Returning arrays
Topic Summary:
Created On: 5-May-2005 20:27
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
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.
 5-May-2005 20:27
User is offline View Users Profile Print this message


Mary Miller

Posts: 36
Joined: 12-Sep-2002

Hello,

I do not believe it is possible to return arrays in DXL, and I thought I would ask anyway. If it is not possible to return an array, is it possible for an array to be assigned to a skip list, and then return a skip list?

I know the last part isn't quite correct. I would probably need a reference or a pointer if DXL has such things as pointers. The code shows the essence of what I would like to do.

Code attached below.

Mary

Report this to a Moderator Report this to a Moderator
 5-May-2005 23:24
User is offline View Users Profile Print this message


Bruce Tuskey

Posts: 77
Joined: 2-Mar-2004

If you pass a string array into a function, DXL automatically does it by reference. You should also include the array size.

You can also do it with a skip list.

See attached code:

-------------------------
Bruce Tuskey
Sr. Principle Engineer
Tuskey@gmail.com

"All that is gold does not glitter, not all those who wander are lost:..." - Gandalf the Grey (JRR Tolkien)
Report this to a Moderator Report this to a Moderator
 6-May-2005 15:27
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The DXL manual is a little confusing, so lets make sure we are not talking about the dxl type "Array" (upper case A) which is a dynamically sized 2-dimensional construct that can contain a variety of data types; and that we are talking about an "array" (lower case a), a specifically sized 1-dimensional construct that can apply to most other Types, such as "strings" and "integers". These should be but are not called "vectors". "arrays" are defined by adding [size] to the declaration of the variable such as "string a[20]".

Array as Parameter (your 2nd example).

Scalors (non-array variables with a single values) such as "string s" cannot be cleverly converted to an array. If your function has an array as a parameter such as "void GetValue(string a[])", all calls to GetValue need to already have the array declared, such as "string a[20]; GetValue(a)". Calling functions should routinely find out how big the array is with "int aSize = sizeof(a)".

Array as return value (your 1st example).

Likewise, your variable assignments much match: both the assigner and assignee must both be arrays or neither be an array.

See attached. Notice the odd syntax for declaring a function that will return an array (brackets at the end).

Notice that array assignment is by-reference, and not by-value, which is different than scaler assignment.

I'd avoid functions that return arrays.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

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