Are strings always null terminated? #1129
-
Janet stores the length of strings, so they don't need to be null terminated. I found that at least some strings are null terminated, but is this guaranteed or just a coincidence? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
EDIT: I had a bug in my test setup, my original answer (below) is not correct, janet strings are in fact always null terminated. No. After some testing I found out that janet strings are not guaranteed to be null terminated. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
JANET_STRING
s are always null-terminated, but they might contain null bytes inside their payload as well, so they aren't exactly C-string compatible.JANET_BUFFER
s are not null-terminated.