Tuesday, December 12, 2017

Digest for comp.lang.c++@googlegroups.com - 8 updates in 2 topics

James Kuyper <jameskuyper@verizon.net>: Dec 11 06:27PM -0500

On 12/11/2017 12:10 PM, Richard wrote:
...
> "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> spake the secret code
> <p0mcpt$a5d$1@dont-email.me> thusly:
....
>> *p_out++ = L'\xe2\x9e\xb2';
>> }
 
> How can you have a character literal with three bytes in it?
 
"An ordinary character literal that contains more than one c-char is a
multicharacter literal. A multicharacter literal, or an ordinary
character literal containing a single c-char not representable in the
execution character set, is conditionally-supported, has type int, and
has an implementation-defined value." (2.14.3p1)
 
> If you
> want a unicode character literal, isn't it more portable to specify
> the character code via \u or \U?
 
Yes, somewhat. The members of the execution character set are
implementation-defined, and for a given UCN, "if there is no
corresponding member, it is converted to an implementation-defined
member other than the null (wide) character." (2.2p5)
 
Strictly speaking, it's implementation-defined behavior either way, but
it's completely implementation-defined for multicharacter literals,
UCN's are only implementation-defined if there's no corresponding member
of the execution character set.
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 12 02:16PM +0100

On 12/11/2017 7:45 PM, Richard wrote:
 
>> Like there is some really simple elegant way to do it that just refuses
>> to pop up in my brain.
 
> Some standard algorithm perhaps?
 
Uhm, something.
 
In my experience, when I've felt this way, someone else has always been
able to really simplify things.
 
Which sort of indicates that I too could do that if I just got that
thinking elevated some levels up from my unconscious mind... But I'm
reduced to asking.
 
 
> If you're just stripping your internal "continuation" character, then
> isn't it just copy_if?
 
With a continuation character at the end of a line, it and the newline
are stripped.
 
Cheers!,
 
- Alf
Manfred <noname@invalid.add>: Dec 12 03:58PM +0100

On 12/11/2017 5:46 PM, Alf P. Steinbach wrote:
> I know of one alternative, to completely dispense with the logic and
> just use Very Long Lines in the string literal. But that also feels wrong.
 
I may be misinterpreting what you need, anyway, if it is about reflowing
a string literal, here is an alternative, wherein the only artifacts are
\n and terminal \ continuations (which are at least standard, instead of
➲, which by the way might be wanted in the text)
 
#include <iostream>
 
const char flowed_about_text[] =
u8"Let 𝘜 be the encoding last saved as default, or, if that encoding
isn't Unicode,\
let 𝘜 be UTF-8 with BOM.\n\
\n\
When a buffer is activated and has not already been checked:\n\
\n\
if the document is empty and its encoding isn't Unicode, then\n\
its encoding is set to 𝘜.\n\
\n\
Ideally the "when a buffer…" should have been "when file a is opened or\
a new document is created", but\
apparently Notepad++ does not inform a plugin of its creation of new\
documents. Also, ideally the forced encoding should have been the one\
currently selected as default in Notepad++, but apparently Notepad++
does not\
make the dynamic configuration info available to a plugin.\n\
\n\
Author's mail address: alf.p.steinbach+npp@gmail.com";
 
int main()
{
std::cout << flowed_about_text << std::endl;
}
 
This works fine with gcc and a utf-8 compliant terminal, I believe you
know how to make it work on Windows..
Jorgen Grahn <grahn+nntp@snipabacken.se>: Dec 12 03:58PM

On Mon, 2017-12-11, Richard wrote:
 
> I see lots of weird formatting when I view this in my newsreader (trn),
> but it's probably because you're using UTF-8 for characters that are
> perfectly representable in ASCII and my newsreader is old.
 
Nitpick: if an UTF-8 character is representable in ASCII, its ASCII
representation is also its UTF-8 representation.
 
You're talking about using the fancy non-ASCII quote characters and so
on.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 12 05:15PM +0100

On 12/12/2017 3:58 PM, Manfred wrote:
> a string literal, here is an alternative, wherein the only artifacts are
> \n and terminal \ continuations (which are at least standard, instead of
> ➲, which by the way might be wanted in the text)
 
➲ in the text works just fine, and at the end of a line can be
represented by ➲➲ followed by an extra newline, which the simple general
continuation rule then reduces to a single ➲ plus \n.
 
 
> }
 
> This works fine with gcc and a utf-8 compliant terminal, I believe you
> know how to make it work on Windows..
 
I like this. Explicitly representing the newlines instead of explicitly
representing the absence of newlines. I just knew there had to be
something like this, obvious to all but myself. :-)
 
Cheers!, and thanks,
 
- Alf
legalize+jeeves@mail.xmission.com (Richard): Dec 12 10:15PM

[Please do not mail me a copy of your followup]
 
Jorgen Grahn <grahn+nntp@snipabacken.se> spake the secret code
>representation is also its UTF-8 representation.
 
>You're talking about using the fancy non-ASCII quote characters and so
>on.
 
Yes, I'm talking about Unicode ' where ASCII ' would have worked just
fine. The same goes for a bunch of other characters. Do we really
need to distinguish between a dash and an emdash on usenet, or email?
No.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
legalize+jeeves@mail.xmission.com (Richard): Dec 12 10:15PM

[Please do not mail me a copy of your followup]
 
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> spake the secret code
>> isn't it just copy_if?
 
>With a continuation character at the end of a line, it and the newline
>are stripped.
 
So it's copy_if with a predicate that holds some state about the
previous character.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Vir Campestris <vir.campestris@invalid.invalid>: Dec 12 09:25PM

On 07/12/2017 07:08, Marcel Mueller wrote:
> than the junk posts that can be mostly filtered by blacklists. In fact a
> common, /moderated filter list/ would be significantly more effective.
> Too bad that there is no standard for that.
 
I believe uk.legal.moderated operate such a system.
 
Andy
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: