• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] JASS type/variable limits?

Status
Not open for further replies.
Level 2
Joined
Mar 5, 2013
Messages
8
I'm working on a new JASS parser/compiler, and was curious to know if anybody had any idea as to what the min/max values are for integers, reals, strings, etc... I'm already aware that arrays can hold an approximate maximum of 8190 elements, but are integers signed ints, unsigned ints, or perhaps even signed/unsigned longs? Are reals floating-point or double-precision values? How many characters can a string variable hold? etc...

And of course, the ultimate question: What is the maximum number of variables (of any type) that is allowed for any given script? If anybody has the answers to any of these questions, please let me know!
Meanwhile, I will simply adhere to the limits and default types used by the language I am compiling in.
 
Last edited:
Level 14
Joined
Jun 27, 2008
Messages
1,325
I think the max number of variables is also 8192
no

I'm working on a new JASS parser/compiler, and was curious to know if anybody had any idea as to what the min/max values are for integers, reals, strings, etc... I'm already aware that arrays can hold an approximate maximum of 8190 elements, but are integers signed ints, unsigned ints, or perhaps even signed/unsigned longs?
integer is 32 bit signed, so -2.147.483.648 to 2.147.483.647.
strings: http://www.wc3c.net/showthread.php?t=46053
reals are 32 bit single-precision floating point numbers, so -(2 - 2^-23) × 2^127 to (2 - 2^-23) × 2^127

And of course, the ultimate question: What is the maximum number of variables (of any type) that is allowed for any given script? If anybody has the answers to any of these questions, please let me know!
About 25 000.
 
Level 2
Joined
Mar 5, 2013
Messages
8
I think the maximum string length is 255 or there about.

According to THIS thread originally linked by muzzel, WC3 uses a multi-byte character set with a maximum of 2048 bytes (or 1024 multi-byte characters, depending on if the char is 1 or 2 bytes wide).
In the same thread, Vexorian (creator of JassHelper, Grimore and other JNGP contributions) also comments that the GUI editor + some native functions such as SetMapMusic will trim any given string value down to 255 characters...
Which, my guess, is essentially because it is expecting a 'filepath' of sorts (and reasonably, the default C++ macro for MAX_PATH is 255).

So what I've done is set MAX_CHAR to 2048, and made a note to validate the size of these strings down to a maximum of 1024 bytes given the situation where all the characters in a string are 2 bytes wide.
And as for the native trimming, well, that is done automatically by WC3 so the best I can do is issue a compiler warning when passing large strings to certain native functions (which may or may not be determinable during compile-time).

So much on the 'TODO' list, so little time...
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
I don't know anything about limits, but it might be worthy of note that Russian versions of WC3 accept a wider range of symbols. In European/American versions, Russian characters do not show up. When someone speaks in Russian, it appears to people with the original version as if they're just spamming spaces (empty messages).
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I don't know anything about limits, but it might be worthy of note that Russian versions of WC3 accept a wider range of symbols. In European/American versions, Russian characters do not show up. When someone speaks in Russian, it appears to people with the original version as if they're just spamming spaces (empty messages).

False

Its not that the WC3 version has more symbols than the other versions, its that the default font doesn't support the symbols. When you type in a diff. language, its not displaying anything because the font doesn't have those symbols. When it comes to the bitsequence of the characters, there's no change.

Try it for yourself, switch the font to russian and you'll be able to see the symbols fine.
 
Level 2
Joined
Mar 5, 2013
Messages
8
Well in any regard, I believe I'm safe with the way I'm currently handling strings.
And if not, well then I have it set up for easy adjustments.
Thanks everyone!
 
Status
Not open for further replies.
Top