Board index » cppbuilder » Max String size

Max String size


2006-04-08 05:59:01 PM
cppbuilder66
Hi,
How many characters can I insert into a String at most?
 
 

Re:Max String size

"Cenk" < XXXX@XXXXX.COM >wrote:
Quote

How many characters can I insert into a String at most?
That depends on how big the objects is to begin with. Since
you said "String", I'll assume that you ment AnsiString
because String is a typedef for AnsiString.
AnsiString uses 13 bytes for the underlying object and then
a byte for each character in the string. The biggest that an
AnsiString can be is that of a signed int (2GB) but since it
uses 13 bytes the max number of characters is 2GB - 13.
~ JD
 

Re:Max String size

"Cenk" < XXXX@XXXXX.COM >wrote in message
Quote
How many characters can I insert into a String at most?
The technial limit is MaxInt (2,147,483,647) characters, maybe even
MaxInt-12 (2,147,483,635) characters for the extra tracking that AnsiString
does internally. But in practicality, it is limited only by available
memory since you will almost never be able to allocate that much memory in a
single block.
Gambit
 

{smallsort}