• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-1342
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Strife Onizuka
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

Mono: Boolean AND (&&) and Boolean OR (||) were incorrectly mapped to the bitwise operators.

Created: 30/Jan/08 03:19 AM   Updated: 12/Feb/08 12:28 PM
Return to search
Component/s: Scripts
Affects Version/s: Mono Beta
Fix Version/s: None

Issue Links:
Relates
 

Linden Lab Issue ID: DEV-9749
Linden Lab Internal Branch: mono-based-on-77880


 Description  « Hide
The && and || operators (Boolean AND and Boolean OR respectively) have been mapped to the bitwise operators. This can result in code that does not work properly when the operands are not pure booleans. What is the point in having separate operators if they do the same thing.

[code]
AND(integer a, integer b)
{
integer c = a && b;
if(c)
llOwnerSay(llList2CSV(["TRUE",a,b,c]));
else
llOwnerSay(llList2CSV(["FALSE",a,b,c]));
}
OR(integer a, integer b)
{
integer c = a || b;
if(c)
llOwnerSay(llList2CSV(["TRUE",a,b,c]));
else
llOwnerSay(llList2CSV(["FALSE",a,b,c]));
}

default
{
state_entry()

{ llOwnerSay("=========================================================="); AND(-38, 1); AND(1, 2); AND(1, 1); AND(11, 7); OR(-38, 65); OR(6, -56); OR(1, 456); }

}
[/code]

LSO Output:
[3:13] QA HUD - Final 20060428: TRUE, -38, 1, 1
[3:13] QA HUD - Final 20060428: TRUE, 1, 2, 1
[3:13] QA HUD - Final 20060428: TRUE, 1, 1, 1
[3:13] QA HUD - Final 20060428: TRUE, 11, 7, 1
[3:13] QA HUD - Final 20060428: TRUE, -38, 65, 1
[3:13] QA HUD - Final 20060428: TRUE, 6, -56, 1
[3:13] QA HUD - Final 20060428: TRUE, 1, 456, 1

Mono Output:
[3:12] QA HUD - Final 20060428: FALSE, -38, 1, 0
[3:12] QA HUD - Final 20060428: FALSE, 1, 2, 0
[3:12] QA HUD - Final 20060428: TRUE, 1, 1, 1
[3:12] QA HUD - Final 20060428: TRUE, 11, 7, 3
[3:12] QA HUD - Final 20060428: TRUE, -38, 65, -37
[3:12] QA HUD - Final 20060428: TRUE, 6, -56, -50
[3:12] QA HUD - Final 20060428: TRUE, 1, 456, 457



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Strife Onizuka added a comment - 30/Jan/08 03:22 AM - edited
This fouls up a significant amount of my code. It would take me days if not weeks to go through all my code to work around this. Took forever to track this one down.

Lex Neva added a comment - 30/Jan/08 08:41 AM
Don't worry, with such a glaring bug, I seriously doubt they would just leave it unfixed and make you work around it Nice find.

McCabe Maxsted added a comment - 30/Jan/08 09:39 PM
Aha, that explains the error I was seeing. Nice detective work, Strife As Lex said, I seriously doubt they'll let this slide into release.