HP Forums
Null character not correctly managed (bug) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Null character not correctly managed (bug) (/thread-9527.html)



Null character not correctly managed (bug) - Dimitri - 11-18-2017 11:36 PM

Hello,

The null character in a string is not correctly managed.
If you enter "AB\0DEF" in the HOME view, "AB" is displayed but when you copy the result (from the right of the screen), all the characters are displayed in the entry line.
SIZE("\0") returns 1.
SIZE("A\0BC"+"D") returns 2. So '+' doesn't managed characters after '\0'.
cat ("A","\0","B") displays "0undef0".

In my opinion the null character must be managed like other characters because the HP PPL language is an high level language, even if in C/C++ the null character is used for delimited the end of a string.

Best regards.


RE: Null character not correctly managed (bug) - salvomic - 11-19-2017 06:23 PM

(11-18-2017 11:36 PM)Dimitri Wrote:  Hello,

The null character in a string is not correctly managed.
...
SIZE("A\0BC"+"D") returns 2. So '+' doesn't managed characters after '\0'.
...

not only: SIZE("A\0BC") returns 4 (A, \0, B, C?)...
And after the Enter it is visualised SIZE("A"). Only if re-edited it contains still ("A\0BC"), as if \0 "would absorb" BC...

EDIT:
SIZE(\04875) returns 5
SIZE(77\04875) returns 7
as \0 computed as 1 char


RE: Null character not correctly managed (bug) - webmasterpdx - 11-21-2017 04:13 PM

I'm guessing it has a mixture of code that treats the null as a string terminator and code that doesn't....which would be the source of such a bug.