Aaaaaaaaaaaaaaarg! Where is your head at?

I don't understand. How is calling a byte string a character string useful?

It's not "calling a byte string a character string". It's calling a string containing multi-byte characters, a character string.

Because the only way SvPVX() can return a pointer to more than 2 bytes of ram at the C-level, is if the SV contains a scalar containing 2 (multi-byte) characters at the Perl level.

If the scalar contains a string containing just two bytes, then SvPVX() will return a pointer to just exactly 2 bytes. It can do nothing else, as we've at length established, because SvPVX() performs no coercions.

(You still haven't demonstrated how you can get those four to exist with only two string types)

You know that +1 and the assigned \0 in your code, don't allocate +1 and don't put \0 and there you go.

Now you're either just taking the piss, or you're talking gibberish.

Because there is no +1 in my code, and the only assignment of \0 is into the output buffer. Which has nothing whatsoever to do with the input accessed via SvPVX().

The "those four to exist" to which I refer, are the four possibilities that you claimed SvPVX() could return a pointer to, variously, either 2, 3, 4 or 5 bytes of ram.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

In reply to Re^52: Interleaving bytes in a string quickly by BrowserUk
in thread Interleaving bytes in a string quickly by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.