![]() |
Default Strings - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Wishlist (https://www.boriel.com/forum/forumdisplay.php?fid=14) +---- Thread: Default Strings (/showthread.php?tid=506) |
Default Strings - compiuter - 11-05-2012 I don´t know about the default strings, but old compilers had options to select string length, my question is about effect of retail length of strings. Example: DefaultShort=8 chars DefaultLong=32 chars. What do you think of this? Re: Default Strings - boriel - 11-06-2012 compiuter Wrote:I don´t know about the default strings, but old compilers had options to select string length, my question is about effect of retail length of strings. Example: DefaultShort=8 chars DefaultLong=32 chars. String length here are dynamic. They only take 2 + LEN(string) bytes in memory. When a string grows (e.g. A$ = A$ + " "), the block is resized and/or reallocated. Then the string shortens (e.g. A$ = A$(2 TO) or the like). Nothing is done... unless the length decreased 4 or more bytes. In such case, the block is resized and/or reallocated and the memory freed. Upon each block realloacation, the heap is defragmented. |