in reply to Re^18: Interleaving bytes in a string quickly
in thread Interleaving bytes in a string quickly
Gotcha! (at last!).
After utf8::upgrade($byte_string);, $byte_string is no longer a byte string. It's a character string, or a codepoint string. But not a "byte string". I was (as a result of your previous pedantry), very specific in my choice of title for this thread.
And, as I said back up there somewhere, "Data either originates from within my program, or from without. And in either case, Perl will treat it as bytes unless I do something explicit to indicate that it should do otherwise. And since I know I'm not going to do that, I do not have to consider it.".
And, despite your continued attempts to defend it, your assertion that my posted code "...can silently encode your bytes using UTF-8.", is just plain fiction. Any encoding has to be done, explicitly, by the programmer. It cannot occur "silently".
And, "Magic isn't handled if any is present." is irrelavant!
So that brings us back to "It can segfault ...". Guess what:
Ignoring that your attempt to correct your perceived deficiencies in my code, contains
if (!sv_in || !sv_pad) croak("usage");
which is a redundant code path that will never be exercised. And this:
{ STRLEN i = l_in;
which is never used.
It can also segfault! Try this
print interleave_bytes( undef, 0 );
And that's not the only failure mode it displays.
So, if you're gonna stand on that high horse throwing stones, you really ought to make sure that your mount doesn't have a glass jaw!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^20: Interleaving bytes in a string quickly
by ikegami (Patriarch) on Mar 01, 2010 at 02:46 UTC | |
by BrowserUk (Patriarch) on Mar 01, 2010 at 13:46 UTC | |
by ikegami (Patriarch) on Mar 01, 2010 at 13:57 UTC | |
by BrowserUk (Patriarch) on Mar 01, 2010 at 14:20 UTC | |
by ikegami (Patriarch) on Mar 01, 2010 at 14:50 UTC | |
|