"No more than 30 characters, null terminated"
Jeffrey Lee (213) 6048 posts |
The above text is taken from the PointerV 1 description in PRM5a. On reading it, would you interpret it as meaning 30 characters (i.e. 30 bytes) and then a null terminator, or 30 characters (i.e. 30 bytes) including the null terminator? I’d assume it’s 30 characters and then the terminator, especially since that’ll result in a nice round structure size of 40 bytes (there’s 9 bytes of data before the string). But MousSetup seems to think it’s 30 bytes including the terminator (although note the array length isn’t actually used in any way by the code, so longer strings will work, up to a point) So this is more of a documentation bug/query than a code bug. |
Steffen Huber (91) 1953 posts |
My natural interpretation would be “30 characters and then the terminator”. Because null is not a character in my book, but I am a strong-typing guy and not a C/Assembler fan. But while you’re at it, update the docs to say “30 single-byte-encoded characters” before someone assumes UTF-8… |
Sprow (202) 1158 posts |
A further piece of evidence: look at the Templates file for the RISC OS 3 Configure, it’s prefilled with 30 digits and TemplEd tells me the max size is 31 (ie. 30+terminator). So MousSetup’s struct would appear to be wrong (note the Toolbox String set gadget has space for 40 characters). |
Rick Murray (539) 13840 posts |
This. If it had said “30 bytes, null terminated” then that’d be a different thing. |