Max String Size in KA?

Gordon Finlay
Elite Warrior
Elite Warrior
 
Posts: 238
Joined: 14th Nov 2000
Location: San Diego, CA, USA

Max String Size in KA?

Postby Gordon Finlay » Mon Feb 14, 2011 7:32 pm

Anybody know how big you can make a variable string before KA explodes?

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

Postby Dater » Tue Feb 15, 2011 2:42 am

sorry, can't help you there :(

But don't forget our appointment on saturday! ;)
Dater: "Yeah, Teeth. Thanks for pushing me into a black hole!"

Image

RedHotChiliDog
Field Marshal
Field Marshal
 
Posts: 2742
Joined: 14th Nov 2000
Location: Gahanna, Ohio

Postby RedHotChiliDog » Tue Feb 15, 2011 5:16 am

That is an interesting question. As far as the preprocessor goes, it should be a minimum of 509 characters if it is to meet ANSI compatibility. I personally use the Microsoft C precompiler which allows for 2048 characters. I am not certain what the WATCOM precompiler allows but would most likely at least meet the ANSI standards.

The Interplay compiler is a different story. Even though the preprocessor may allow a specific string size, the Interplay compiler may be limited itself upon creation of the binary. Even though it is not technically C code, I would hope that the Interplay compiler would at least support the minimum ANSI compatibility standards for C since they recommended using a C preprocessor when creating scripts.

I am working on the final patched version for campaign script 6 and also my other scripting project so I will try to see what limits the compiler will let me assign a string while I am working on these. I will report the results that I get.
RedHotChiliDog

Klingons and Potato Chips are better with ridges.

brianmoler.com - Mission scripting and other strangeness

RedHotChiliDog
Field Marshal
Field Marshal
 
Posts: 2742
Joined: 14th Nov 2000
Location: Gahanna, Ohio

Postby RedHotChiliDog » Tue Feb 15, 2011 5:48 am

It appears that the maximum string size allowed is 3,071. Going higher than this appears to crash the Interplay compiler.
RedHotChiliDog

Klingons and Potato Chips are better with ridges.

brianmoler.com - Mission scripting and other strangeness

teeth_03
Order of Kahless
Order of Kahless
 
Posts: 3067
Joined: 2nd Jul 2003
Location: Somewhere in the Matrix

Postby teeth_03 » Tue Feb 15, 2011 2:22 pm

was it fun finding that number? lol

Gordon Finlay
Elite Warrior
Elite Warrior
 
Posts: 238
Joined: 14th Nov 2000
Location: San Diego, CA, USA

Postby Gordon Finlay » Tue Feb 15, 2011 5:33 pm

That's useful to know. Is that for compile only, or can we have a bigger one at run-time?

RedHotChiliDog
Field Marshal
Field Marshal
 
Posts: 2742
Joined: 14th Nov 2000
Location: Gahanna, Ohio

Postby RedHotChiliDog » Wed Feb 16, 2011 4:50 am

Gordon Finlay wrote:That's useful to know. Is that for compile only, or can we have a bigger one at run-time?


That was the number that I was able to reach before the compiler would crash and not create the binary. I did not test this in runtime though. According to MS documentation the limit is 2,048 for my C compiler and I would imagine that this would cover runtime as well. If the limit is 2,048 for the MS compiler then the Interplay compiler is letting us use a larger string than would be normally permitted if it were able to be compiled as a straight C program.

I would need to test this to know for sure though. I was able to read documentation that specified the limits for the MS compiler but the Interplay compiler did not come with such documentation so I had to do some testing before coming up with that 3,071 number.
RedHotChiliDog

Klingons and Potato Chips are better with ridges.

brianmoler.com - Mission scripting and other strangeness

Gordon Finlay
Elite Warrior
Elite Warrior
 
Posts: 238
Joined: 14th Nov 2000
Location: San Diego, CA, USA

Postby Gordon Finlay » Wed Feb 16, 2011 4:53 pm

I'll give it a test when I get home.

I figure a "while ... loop" with a strTest := strTest +"A" and iLen := iLen + 1, followed by a debug("Length: " + iLen); should do the trick.

Will let you know how it goes.

Gordon Finlay
Elite Warrior
Elite Warrior
 
Posts: 238
Joined: 14th Nov 2000
Location: San Diego, CA, USA

Postby Gordon Finlay » Thu Feb 17, 2011 1:24 am

Okay, so it took about 20 seconds to run (while in "critical procedure"), but KA's max run-time string is greater than or equal to 5000 characters.

RedHotChiliDog
Field Marshal
Field Marshal
 
Posts: 2742
Joined: 14th Nov 2000
Location: Gahanna, Ohio

Postby RedHotChiliDog » Thu Feb 17, 2011 2:19 am

That is very interesting. I would not have thought that the run-time length would be any different from the length the compiler would permit with a string variable. Good to know in any event. Thanks for the info!
RedHotChiliDog

Klingons and Potato Chips are better with ridges.

brianmoler.com - Mission scripting and other strangeness


Return to Mission Scripting

cron