![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Louie:
Is there a "Louie's TidBit #1" posted on the board? I'm unable to see one. -Pete ------------------------- pete.kowalski(at)motorola.com |
|
![]() |
|
![]() |
|
#1 was written before I figured there would be a #2. See thread "Current sensitive commands".
|
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Odd, since I get this error all the time but cannot see the actual problem.
- Louie |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
<< 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). |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.