01-09-2005, 09:17 AM
You can't do len(UDT) in QB, you are actually doing len(single) there, "u" is being magically declared by QB as a Single var (the default type).
FB returning different values is actually a bug, i added a proc to calculate the real-len of UDT (w/o padding) to speed up SWAP and user type assignament s(so the padding is not swapped/copied), and LEN() was calling the same code.. fixed.
Yeah i lied, you actually can have chr$(0) on var-len strings, they are never scanned for the null-char as fixed-len are. But calling any API function passing that string will mostly fail, as PRINT does -- i can't do anything, you got byte arrays in FB, i dunno why someone would put a null-char inside a string -- if FB strings were not null-terminated, EVERY function call with string arguments to ANY lib would need this: "stringparam + chr$( 0 )", what wouldn't be quite fun to do all the time -- hey, they are living with that "restriction" in C for decades, nobody complained..
And yeah, FB integers are 4 bytes long, you know, it's a 32-bit compiler, it makes sense -- and yet, you can do defshort a-z or declare all vars as "v as short" if you really need 16-bit integers.
FB returning different values is actually a bug, i added a proc to calculate the real-len of UDT (w/o padding) to speed up SWAP and user type assignament s(so the padding is not swapped/copied), and LEN() was calling the same code.. fixed.
Yeah i lied, you actually can have chr$(0) on var-len strings, they are never scanned for the null-char as fixed-len are. But calling any API function passing that string will mostly fail, as PRINT does -- i can't do anything, you got byte arrays in FB, i dunno why someone would put a null-char inside a string -- if FB strings were not null-terminated, EVERY function call with string arguments to ANY lib would need this: "stringparam + chr$( 0 )", what wouldn't be quite fun to do all the time -- hey, they are living with that "restriction" in C for decades, nobody complained..
And yeah, FB integers are 4 bytes long, you know, it's a 32-bit compiler, it makes sense -- and yet, you can do defshort a-z or declare all vars as "v as short" if you really need 16-bit integers.
ew FreeBASIC forums: http://www.freebasic.net/forum/index.php