Friday, January 18, 2019

Digest for comp.lang.c++@googlegroups.com - 19 updates in 5 topics

carlglassberg@gmail.com: Jan 18 02:04PM -0800

So I need C++11 grammar to use with TC++PL4, which is N3242 draft standard?
Carl
---
On Friday, January 18, 2019 at 6:57:09 AM UTC-8, Manfred wrote:
jameskuyper@alumni.caltech.edu: Jan 18 02:19PM -0800

> So I need C++11 grammar to use with TC++PL4, which is N3242 draft standard?
 
Yes. Amazon.com's description for the 4th edition indicates that it
describes C++2011, so if you desire an exact match, you shouldn't use a
more current version of that standard. Personally, though, I think
you'll be better off with the latest draft version: n4659.pdf, even if
it doesn't exactly match the book.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 18 05:28PM

On 18/01/2019 17:21, David Brown wrote:
 
> (And while I disagree fundamentally with your claim that evolution
> "disproves" Rick's god, I do agree with you that his claims that science
> is proving the Bible are complete nonsense.)
 
Wrong. The existence of the Abrahamic god is predicated on the Torah being
the factual Word of God. The Torah is false. Some god may exist but that
god is a different god to the one described in the Torah and supposedly
responsible for the contents of the Torah.
 
/Flibble
 
--
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who
doesn't believe in any God the most. Oh, no..wait.. that never happens." –
Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a
world that is so full of injustice and pain. That's what I would say."
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 18 09:33AM -0800

On Friday, January 18, 2019 at 12:23:31 PM UTC-5, Mr Flibble wrote:
> A) Your bible is false.
> B) Your god the existence of which is predicated on your bible being true
> is, given (A) also false.
 
https://imgflip.com/i/17zjin
 
I'll take my leave of you now, Leigh. I pray you come to know
Jesus before you leave this world. It will be to your best end.
Good bye. I wish you much success on your neoGFX project.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 18 05:36PM

On 18/01/2019 17:33, Rick C. Hodgin wrote:
 
> I'll take my leave of you now, Leigh. I pray you come to know
> Jesus before you leave this world. It will be to your best end.
> Good bye. I wish you much success on your neoGFX project.
 
Nonsense.
A) Your bible is false.
B) Your god the existence of which is predicated on your bible being true
is, given (A) also false.
 
/Flibble
 
--
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who
doesn't believe in any God the most. Oh, no..wait.. that never happens." –
Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a
world that is so full of injustice and pain. That's what I would say."
gazelle@shell.xmission.com (Kenny McCormack): Jan 18 06:32PM

In article <8a5c242f-c665-4b33-b71d-e37163b9907f@googlegroups.com>,
>> all but it is entirely possible to disprove a SPECIFIC god such as the god
>> of Abraham.
 
>What is my driving impetus for bashing you over the head with something like this?
 
We all just assume it is your psychoses and your mental defects driving it.
 
Maybe your mother drank while you were in the womb?
 
FAS is a real problem.
 
--
If Jeb is Charlie Brown kicking a football-pulled-away, Mitt is a '50s
housewife with a black eye who insists to her friends the roast wasn't
dry.
Daniel <danielaparker@gmail.com>: Jan 18 10:52AM -0800

On Friday, January 18, 2019 at 12:01:12 PM UTC-5, David Brown wrote:
 
> No, you don't have to define something to say that you have no belief in
> its existence.
 
I disagree. If you say, "I don't believe in X", but don't define X, the
statement is vacuous.
 
> If I say "I have no belief in unicorns", then I don't need to specify if
> it is green unicorns or pink unicorns that I don't believe in. It
> covers a whole wide class of unicorns, without the need of any details.
 
The idea of "unicons" needs to have some properties, or the statement is
vacuous.
 
Daniel
David Brown <david.brown@hesbynett.no>: Jan 18 08:25PM +0100

On 18/01/2019 19:52, Daniel wrote:
>> covers a whole wide class of unicorns, without the need of any details.
 
> The idea of "unicons" needs to have some properties, or the statement is
> vacuous.
 
Yes, /some/ properties are needed. But not the details. "I don't
believe in deities" is enough.
Daniel <danielaparker@gmail.com>: Jan 18 12:10PM -0800

On Friday, January 18, 2019 at 2:25:12 PM UTC-5, David Brown wrote:
 
> Yes, /some/ properties are needed. ... "I don't believe in deities" is
> enough.
 
I disagree. To be meaningful, the statement has to be meaningful to an
observer. An observer can't know what you mean by the word "deity" unless you
enumerate at least some its properties.
 
As an aside, in many discussions about the existence/non-existence of
"deities", the term is left undefined and the exchanges rendered meaningless,
because the discussants have very different mental representations of the
term "deities". Sometimes the discussion is framed this way as a polemical
device, with the intention of instilling believe in a specific deity by
appealing to vague notions of a very general one.
 
There are serious physicists that countenance the existence of a conscious
universe, and serious philosophers that countenance a qualified panpsychism
view of consciousness, which some could think of as "deity-like" attributes.
The universe is a very strange place. So, when making a statement I "believe
in X"/"don't believe in X", pity the observer, say what X is.
 
Daniel
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 18 06:35PM +0100

On 18.01.2019 15:15, Ralf Fassel wrote:
> used before init".
 
> MSVC 2017 raises an error about s2 not being known, but if I comment
> that line out, it also compiles (and crashes)...
 
The probability of doing something wrong when an identifier is used in
the declaration of that identifier, is IMO /very/ high.
 
One can construct artificial examples where one might argue that it's a
useful language feature, e.g. for a circular list with header node,
 
Node header{ &header };
 
But.
 
Anyway it's there. Compilers have to accept it. But as you point out,
they really should diagnose it.
 
With the above node example I get no diagnostic from `g++ foo.cpp
-std=c++17 --pedantic -Wall` with MinGW g++ 8.2.0, and no diagnostic
from `cl /std:c++17 /W4 foo.cpp` with MSVC 2017. :( If however I remove
the `&`, then both warn about using `header` uninitialized.
 
 
Cheers!,
 
- Alf
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 18 05:39PM

On 18/01/2019 17:35, Alf P. Steinbach wrote:
 
> One can construct artificial examples where one might argue that it's a
> useful language feature, e.g. for a circular list with header node,
 
>     Node header{ &header };
 
Taking the address of an unconstructed object isn't the same as taking the
value of an unconstructed object.
 
/Flibble
 
--
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who
doesn't believe in any God the most. Oh, no..wait.. that never happens." –
Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a
world that is so full of injustice and pain. That's what I would say."
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 18 06:52PM +0100

On 18.01.2019 18:39, Mr Flibble wrote:
 
>>      Node header{ &header };
 
> Taking the address of an unconstructed object isn't the same as taking
> the value of an unconstructed object.
 
Right, but (the language feature:) it requires the name to be available
for use before the end of the declaration.
 
 
Cheers!,
 
- Alf
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 18 07:28PM +0100

On 18.01.2019 19:18, Stefan Ram wrote:
> warning: variable 's2' is uninitialized when used within its own initialization [clang-diagnostic-uninitialized]
> warning: variable 's3' is uninitialized when used within its own initialization [clang-diagnostic-uninitialized]
 
> gcc.gnu.org/bugzilla/show_bug.cgi?id=71228
 
Interesting.
 
But `-Winit-self`, as mentioned somewhat sarcastically in a response to
that bug report, doesn't work (apparently no effect) with MinGW g++ 8.2.0.
 
Cheers!
 
- Alf
Manfred <noname@add.invalid>: Jan 18 07:50PM +0100

On 1/18/2019 7:28 PM, Alf P. Steinbach wrote:
 
> Interesting.
 
> But `-Winit-self`, as mentioned somewhat sarcastically in a response to
> that bug report, doesn't work (apparently no effect) with MinGW g++ 8.2.0.
 
I think there has been some development in gcc after that bug report.
 
#include <iostream>
 
int main()
{
int n { n };
 
std::cout << n << std::endl;
}
 
[tmp]$ g++ -Wall uninit.cc && ./a.out
uninit.cc: In function 'int main()':
uninit.cc:7:7: warning: 'n' is used uninitialized in this function
[-Wuninitialized]
int n { n };
^
0
[tmp]$
 
===
 
But.
 
#include <iostream>
#include <string>
 
int main()
{
std::string s { s };
 
std::cout << s;
}
 
[tmp]$ c++ -Wall selfref.cc && ./a.out
[tmp]$
 
ram@zedat.fu-berlin.de (Stefan Ram): Jan 18 06:18PM

>std::string s1 = func(s1);
>std::string s2(s2);
>std::string s3 = s3;
 
warning: variable 's1' is uninitialized when used within its own initialization [clang-diagnostic-uninitialized]
warning: variable 's2' is uninitialized when used within its own initialization [clang-diagnostic-uninitialized]
warning: variable 's3' is uninitialized when used within its own initialization [clang-diagnostic-uninitialized]
 
gcc.gnu.org/bugzilla/show_bug.cgi?id=71228
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 17 08:46PM +0100

On 17.01.2019 19:31, Paul wrote:
> it needs to be queried where A[780] < B[781].
 
> The same information that can be stored in two vectors can also be stored
> as a single vector of std::pair<int, int>.
 
Or better, a vector of
 
struct Good_name
{
int a;
int b;
};
 
 
> Does a vector of pair<int, int> take up less space than two vectors?
 
Necessarily but it's a constant of a few bytes.
 
 
> Is there any difference in performance between an enquiry to determine
> whether A[780].first < A[781].second compared to the above inquiry
> with separate vectors.
 
Intuition often fails, so, try it.
 
 
> areas of memory whereas comparing A[k].first with A[m].second is faster
> because the A entries are in the same area of memory?
 
> Any thoughts?
 
Go for most clear code.
 
And IMO that's neither separate vectors nor vector of `std::pair`.
 
 
Cheers!,
 
- Alf
Paul <pepstein5@gmail.com>: Jan 17 03:54PM -0800

On Thursday, January 17, 2019 at 9:57:22 PM UTC, Vir Campestris wrote:
 
> And even then it's probably a very small effect.
 
> Premature optimisation (google it) is normally a bad thing.
 
> Andy
 
Good responses by all three (so far).
Thanks a lot!
 
Paul
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 17 08:58PM

On Thu, 2019-01-17, Paul wrote:
> Suppose two vectors of ints are the same size -- say one million entries each.
> Comparisons need to be made between elements in the vectors -- for example
> it needs to be queried where A[780] < B[781].
 
Did you mean A[780] < B[780]?
 
> areas of memory whereas comparing A[k].first with A[m].second is faster
> because the A entries are in the same area of memory?
 
> Any thoughts?
 
A vector of pairs takes up roughly as much space, and lookup in that
one is nicer to the cache than two lookups in two vectors[0].
 
What bothers me is: is this really the main use case for these
vectors? Are they created once, never updated, and only used to
answer the question a[N] < b[N]? If not, you're going to make some
other code uglier and slower. If yes, then a vector<bool> would be
nicer to the cache.
 
/Jorgen
 
[0] Although I cannot say how much of a difference that would make.
It depends on the overall access pattern.
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Vir Campestris <vir.campestris@invalid.invalid>: Jan 17 09:57PM

On 17/01/2019 19:46, Alf P. Steinbach wrote:
> Go for most clear code.
 
> And IMO that's neither separate vectors nor vector of `std::pair`.
 
This.^^^
 
I doubt there would be much performance difference running through them
serially. The only advantage could be if you kept picking out two
entries at random - in this case it's probable the second one will be
loaded in cache with the first with the pairs (or better structure) but
if they aren't near each other you'll get two cache misses.
 
And even then it's probably a very small effect.
 
Premature optimisation (google it) is normally a bad thing.
 
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: