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: Boolean assignment
Topic Summary: DXL doesn't behave like C?
Created On: 24-Oct-2007 14:16
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.
Answer This question was answered by Peter Albert, on Wednesday, October 24, 2007 5:54 PM

Answer:
Hi Jim,

the following works fine in DXL (note the single quotation marks ' instead of the double quotation marks " you used in your original posting. The former are mandatory for char assignments.

char name = 'B'
bool flag
flag = (name == 'S')
print flag


Cheers,

Peter
 24-Oct-2007 14:16
User is offline View Users Profile Print this message


Jim Backus

Posts: 21
Joined: 27-Apr-2006

Hi,

AIUI the following is valid C code (I'm not a C programmer so please forgive syntax errors):

char name = "B"
boolean flag
flag = (name == "S")

The point being that in C a boolean value can be assigned the result of a logical comparison. In the example above 'flag' will be assigned 'False'

However in DXL this doesn't appear to be allowed. Can someone confirm that this is the case?

Presumably the work around is to do the assignment in 'if' statements?

TIA

Jim

-------------------------
Jim Backus<BR>Ultra Electronics, Controls
Report this to a Moderator Report this to a Moderator
 24-Oct-2007 14:24
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Answer Answer
Hi Jim,

the following works fine in DXL (note the single quotation marks ' instead of the double quotation marks " you used in your original posting. The former are mandatory for char assignments.

char name = 'B'
bool flag
flag = (name == 'S')
print flag


Cheers,

Peter
Report this to a Moderator Report this to a Moderator
 24-Oct-2007 14:28
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

char and string are distinct in DXL. Try this:

string name = "B"
bool flag = true
print flag "\n"
flag = (name == "S")
print flag "\n"

It works.

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 24-Oct-2007 15:52
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

As other said, chars use single quotes ' ' and strings use double quotes " ".

The bool part of your code should work and is in fact used fairly often.

Also, I'm a little fuzzy on key words, but since 'name' is the name of a DXL perm, as in "string NameMod = name(mod)", I'd be loath to use 'name' as the name of a variable. I don't know the exact rules but sometimes its going to generate wierd DXL errors.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.