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: Louie's TidBit #2: "incorrect arguments for (if)"
Topic Summary:
Created On: 29-Sep-2003 21:44
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.
 29-Sep-2003 21:44
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Due to popular "demand" I'll start posting DXL tid-bits from time to time. #1 was being sure to set the current module before issuing commands that presume the current module, such as "filtering on".

Tidbit #2: Maybe someone schooled in "C" can elaborate, but I often get "incorrect arguments for (if)" when I have a simple construct like:
.....if (anything)
..... DoSomeFunction()
.....else DoSomethingElse()

The problem isn't "anything" its the existence of DoSomeFunction(); but I don't know why. The solution is to simply but braces around the statement: "{ DoSomeFunction()}".

So if you get this error and can't figure it out, try the braces.

- Louie
Report this to a Moderator Report this to a Moderator
 1-Oct-2003 15:14
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

Louie:

Is there a "Louie's TidBit #1" posted on the board? I'm unable to see one.

-Pete

-------------------------
pete.kowalski(at)motorola.com
Report this to a Moderator Report this to a Moderator
 1-Oct-2003 16:20
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

#1 was written before I figured there would be a #2. See thread "Current sensitive commands".
Report this to a Moderator Report this to a Moderator
 20-Oct-2003 21:17
User is offline View Users Profile Print this message


Alec Witham Crawford

Posts: 24
Joined: 2-Jul-2003

Hi Louie,

I don't see this problem on 5.2. I have seen the problem when you have more than one line after if or else. Then you do need the curly braces to make the block.

This works for me:

void this()
{
ack "this"
}

void that()
{
ack "that"
}

string thats = "zero"
if(thats == "zero")
this()
else
that()


It will also work with the curly braces.

-Alec
Report this to a Moderator Report this to a Moderator
 21-Oct-2003 22:43
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Odd, since I get this error all the time but cannot see the actual problem.

- Louie
Report this to a Moderator Report this to a Moderator
 23-Oct-2003 08:56
User is offline View Users Profile Print this message


Dirk Plaschke

Posts: 103
Joined: 17-Sep-2002

Please consider too, that DOORS (v5.2 & v6.0 SR1) will supress some code if there no parentheses around the function call.

string ergebnis(string s)
{
return("ABC")
}

// This will supress ALL after the call ( )
print "\nresult=" ergebnis("abc") "-def" // -> result=ABC

// This should be correct.
print "\nresult=" (ergebnis("abc")) "-def" // -> result=ABC-def

Dirk.

-------------------------
Dirk Plaschke
Report this to a Moderator Report this to a Moderator
 24-Oct-2003 08:51
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003



<< Please consider too, that DOORS (v5.2 & v6.0 SR1) will supress some code if there no parentheses around the function call.

string ergebnis(string s)
{
return("ABC")
}

// This will supress ALL after the call ( )
print "\nresult=" ergebnis("abc") "-def" // -> result=ABC

// This should be correct.
print "\nresult=" (ergebnis("abc")) "-def" // -> result=ABC-def

Dirk.
>>



This effect seems to be a consequence of DXL not requiring brackets around the argument to a function. In the first call to ergebnis above, the string "-def" is being appended to the string "abc" and the combined string "abc-def" is sent to the function where it is lost (try changing the function to return s).
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.