[email protected] (Ludovic Courtès) writes:
> Anyway, it seems that before, you couldn’t get any encoding error for
> scm_from_stringn ("", "SOME-ENCODING"), whereas now you can.
Good point. I just committed a change to avoid this.
> A related question: can we have both narrow and wide empty strings?
I see one place where a wide null string could be created: vm-i-loader.c
line 115, within the "load-wide-string" vm instruction, calls
`scm_i_make_wide_string' but never calls `scm_i_try_narrow_string' as is
usually done. I guess this might be because "load-wide-string" is
normally never used for strings that contain only Latin 1 characters.
Other than that, I don't see how a wide null string could exist outside
of temporaries, although it's hard to entirely rule out the possibility.
All of the code paths try to avoid using wide strings unless a wide
character is actually present.
If a wide null string did exist, I don't see what harm it would cause,
besides causing failure if `scm_i_string_chars' applied to it.
Thanks,
Mark