I thought it would be a good idea to have a single unified thread to catch people's compiler-specific suggestions, so here's what we have so far:
- /* */ - style comment blocks
- Grouped declarations, i.e. "integer a, b, c, d, e"
- include statement
These forums are CLOSED. Please visit the new forums HERE
LSL Compiler Suggestions |
|
Huns Valen
Don't PM me here.
![]() Join date: 3 May 2003
Posts: 2,749
|
07-03-2003 20:52
/13/76/3514/1.html#post22289
I thought it would be a good idea to have a single unified thread to catch people's compiler-specific suggestions, so here's what we have so far:
|
Huns Valen
Don't PM me here.
![]() Join date: 3 May 2003
Posts: 2,749
|
07-04-2003 06:37
Here's another one...
if(x<gMapYSize-1) // Generates error Enclosing the 1 in parens fixes it. Did you guys put comparisons at the same priority as subtraction or something? |
Wednesday Grimm
Ex Libris
![]() Join date: 9 Jan 2003
Posts: 934
|
07-04-2003 07:51
Originally posted by Huns Valen if(x<gMapYSize-1) // Generates error I've seen this too, adding spaces fixes it also. I think there's a problem with the precedence of the '-' character, that is "-1" with no spaces is always a number, negative 1, so in the above you've got (a < b c) with no operator between b and c so it's an error. If this is confusing, it's because I need coffee. _____________________
Sarcasm meter:
0 |-----------------------*-| 10 Rating: Awww Jeeze! |
Nada Epoch
The Librarian
![]() Join date: 4 Nov 2002
Posts: 1,423
|
07-04-2003 09:32
no more confusing than you usual postes
![]() btw, i agree with your conclusions Mr. WG. _____________________
i've got nothing.
![]() |
Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
|
07-04-2003 10:16
I thought it was because keys have - in them. So gMapYSize-1 could be a (invalid) key. But you could be right. Do you have to have " around keys?
|
Nada Epoch
The Librarian
![]() Join date: 4 Nov 2002
Posts: 1,423
|
07-04-2003 10:25
yeah, keys are strings. which means you can llGiveMoney("Nada Epoch", amount). which is bad for the unwary cause it just makes your money disappear, going to the non-existent object named "Nada Epoch". Everyone can thank bob bunderfield for that little bit of info.
edit-maybe i should say keys follow the same format as strings, rather than they are strings. hmm might be fun to test. _____________________
i've got nothing.
![]() |
Bob Brightwillow
Technologist
Join date: 7 Feb 2003
Posts: 110
|
07-04-2003 16:05
Rather, a string will be implicitly cast to key when a key is expected. I'm away from SL right now, but my guess is that strings that don't look like keys become NULL_KEY when cast. Explains why money disappears into the void in Nada's example, anyway.
|
Nada Epoch
The Librarian
![]() Join date: 4 Nov 2002
Posts: 1,423
|
07-04-2003 17:15
they are strings for all intents and purposes.
CODE
if you touch the prim this script is on, it says I am not a key!. you will also notice that in the llSay i put a (key) instead of a (string), it also works if there is nothing there and the line reads: CODE llSay(0, id); _____________________
i've got nothing.
![]() |
Bob Brightwillow
Technologist
Join date: 7 Feb 2003
Posts: 110
|
07-04-2003 22:44
Yes, that's right. Your example shows that key will be implicitly cast to string, and vice versa, exactly as described in the documentation. ;) They are not, however, the same data type, as keys cannot hold arbitrary string data. I also imagine keys are stored as 16 bytes rather than as one byte per character like a string.
|
Nada Epoch
The Librarian
![]() Join date: 4 Nov 2002
Posts: 1,423
|
07-05-2003 03:22
I guess the real test will be if you can store more characters than keys are normally in them. heh not that it really matters
![]() _____________________
i've got nothing.
![]() |
Huns Valen
Don't PM me here.
![]() Join date: 3 May 2003
Posts: 2,749
|
07-11-2003 17:12
Here's another one... Either have the complier do a first pass to figure out all the function prototypes or let us write the prototypes ourselves, like in C:
list blah(vector v); list duh(string s); As it is now we have to put our functions "in order," because a function can't "see" another function that is defined "after" it. So we get "ERROR : Function call mismatches type or number of arguments." (Which is not exactly accurate...) |
Tcoz Bach
Tyrell Victim
Join date: 10 Dec 2002
Posts: 973
|
07-12-2003 11:07
if (integer i = 0...etc.) would be nice. In line declaration 'n all.
Case switch too but eh we can live without it. _____________________
** ...you want to do WHAT with that cube? **
|
Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
|
07-13-2003 21:46
Do you mean with for() Tcoz, or with if()s ... or just either?
![]() |