Hi all.
Will sizeof(somestring) always be 9 bytes larger than high(somestring)/getstringcapacity(somestring)? Or is it just in one case I have found this...
Best regards Preben
===== Computers are like airconditioners: They stop working properly if you open windows.
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Preben Mikael Bohn wrote:
Will sizeof(somestring) always be 9 bytes larger than high(somestring)/getstringcapacity(somestring)? Or is it just in one case I have found this...
A string contains Capacity and Length (4 bytes each on a 32 bit platform) and an extra character for the #0 when converting to CString.
Frank
--- Frank Heckenbach frank@g-n-u.de wrote:
Will sizeof(somestring) always be 9 bytes larger than high(somestring)/getstringcapacity(somestring)?
A string contains Capacity and Length (4 bytes each on a 32 bit platform) and an extra character for the #0 when converting to CString.
OK, thank you... Is it converted to CString automatically when calling sizeof? Because it is 9 bytes longer than getstringcapacity...
Best regards Preben
===== Computers are like airconditioners: They stop working properly if you open windows.
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
--- Frank Heckenbach frank@g-n-u.de wrote:
Will sizeof(somestring) always be 9 bytes larger than high(somestring)/getstringcapacity(somestring)?
A string contains Capacity and Length (4 bytes each on a 32 bit platform) and an extra character for the #0 when converting to CString.
OK, thank you... Is it converted to CString automatically when calling sizeof? Because it is 9 bytes longer than getstringcapacity...
Not converted, but the extra char is always there (so that it's available when it's needed).
Frank
On Fri, 2 Aug 2002, Frank Heckenbach wrote:
Preben Mikael Bohn wrote:
Will sizeof(somestring) always be 9 bytes larger than high(somestring)/getstringcapacity(somestring)? Or is it just in one case I have found this...
A string contains Capacity and Length (4 bytes each on a 32 bit platform) and an extra character for the #0 when converting to CString.
On ix86 platforms the allocation is rounded up to a multiple of 4 bytes. Thus string( 1 ) is 12 bytes, not 10. Only significant if you have a lot of strings and limited memory.
Russ