Wednesday, November 15, 2017

Digest for comp.lang.c++@googlegroups.com - 15 updates in 3 topics

"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 14 03:42PM -0800

On Tuesday, November 14, 2017 at 5:15:05 PM UTC-5, Öö Tiib wrote:
> Ok, but he sometimes displays capability of thinking rationally. Given
> that it is so difficult to give him benefit of the doubt, I'm sorry.
 
I always think rationally, even in the area of Christianity and teaching
about sin and Jesus Christ.
 
The difference in our perceptions regarding that end are this: I have
been changed from within by God to be able to understand the things of
God. I therefore pursue them as He has given us guidance in the Bible.
 
You have not yet been changed on the inside, so you are only able to
examine my actions through those facilities you know and understand,
which come from your corrupt-in-sin flesh-based mind.
 
It is only when God augments you that you can understand spiritual
things through the new spiritual discernment. Until then, it would
be like trying to see with your skin. It's not designed to do it,
even though far more light hits your skin than your pupil, it's just
not equipped to see.
 
The same thing for spiritual things: your flesh-based mind is not
equipped to understand it properly. And ask with your skin you can
feel heat and you could know the direction of the sun with your eyes
closed and blindfolded, but you could not see. For that you need an
eye. And while some of what I teach to you you can understand, it's
not going to fully register within you until you have spiritual life,
and that's something only God can do for you. Until then, you will
only have hints and glimmers of some of it, but enough won't make
sense that you can conclude easily it's gibberish.
 
But if you are willing to pursue the truth, to seek it ahead of just
assuming you're right, and I'm a lunatic, and that maybe there is some
things more than you already know, THEN God will reach in and make it
possible for you to know it.
 
It's all an act of God working in people, but these messages are given
for those who will be saved, for those who will at some point be changed
in that way so they can understand.
 
These lyrics were not written by accident:
 
"I once was lost, but now am found.
Was blind, but now I see."
 
It happens when God changes you. Consider the other lyrics:
 
"Amazing grace, how sweet the sound,
that saved a wretch like me.
I once was lost, but now am found.
Was blind, but now I see.
 
"'Twas grace that taught my heart to fear,
and grace that fear relieved.
How precious did that grace appear,
the hour I first believed."
 
Those words describe the transformation that happens in a new spiritual
life. When Jesus takes our sin away, we are born again in that self-
same instant. It was fear of God, fear of judgment, fear of Hellfire,
in acknowledging our own sin that brings us to the foot of the cross,
and when we ask forgiveness a real transaction takes place which takes
our sin away and frees us from that burden. You can feel it coming off
you like you've just been paroled.
 
There is nothing else like it. And for a time, the changed life is so
uplifting, fantastic, everything changes. New believers are on fire
for the Lord. But over time the flesh input comes back and many people
begin to go back to their former ways because they've had decades doing
them, and all their former friends do them, and so on.
 
It takes a very strong person to stand up to those former friends and
witness to them and deny their former wants and lusts toward sin, and
to say, "No, I am the Lord's now, and I will live my life in holiness."
 
Very few people can actually do that or very long. And even fewer have
the ability to do it in public, in their jobs, in places where a real
ramification for taking such a stand could alter their life.
 
But it's within all believers to walk that walk. And it is that walk
that non-believers need to see so they too can know the power of God at
work in a changed heart within a man.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 15 06:17PM

On 14/11/2017 22:26, James R. Kuyper wrote:
> forcing us to deal with either his original messages, or the parodies.
> However, just as there's nothing we can do to stop his off-topic posts,
> there's also nothing we can do to stop the parodies of them.
 
If it is a parody and it is obvious that it is a parody then it isn't
identity theft and I am all for it as the bloke being parodied is
annoying and as egregious as fuck.
 
/Flibble
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 15 10:57AM -0800

On Wednesday, November 15, 2017 at 1:17:34 PM UTC-5, Mr Flibble wrote:
> If it is a parody and it is obvious that it is a parody then it isn't
> identity theft and I am all for it as the bloke being parodied is
> annoying and as egregious ...
 
Leigh, there is another way to be, a proper way that looks to do
what's right for right's sake.
 
You are harming people by your ways. I invite you to leave those
harmful ways and come to the Lord and ask forgiveness, and move
toward doing right things to help people.
 
Jesus will give you a reward, and you'll feel it on the inside.
Peace, love, joy, hope. It will fill you like nothing else.
 
I urge you, Leigh, to seek the true way. It will be to your benefit.
 
--
Rick C. Hodgin
Daniel <danielaparker@gmail.com>: Nov 15 11:24AM -0800

On Wednesday, November 15, 2017 at 1:57:33 PM UTC-5, Rick C. Hodgin wrote:
 
> Peace, love, joy, hope. It will fill you like nothing else.
 
I can deal with most things and most situations, but our Mr Flibble radiating Peace, love, joy, hope ... ?
 
No, leave it be.
 
Daniel
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 15 11:30AM -0800

On Wednesday, November 15, 2017 at 2:24:49 PM UTC-5, Daniel wrote:
 
> > Peace, love, joy, hope. It will fill you like nothing else.
 
> I can deal with most things and most situations, but our Mr Flibble radiating Peace, love, joy, hope ... ?
 
> No, leave it be.
 
The Holy Spirit makes all things new. It wouldn't be Leigh, but
new Leigh, just as it's not Rick who teaches about Christ, but new
Rick.
 
You can read about the new birth here:
 
https://www.biblegateway.com/passage/?search=John+3&version=KJV
 
Spiritual life is unlike flesh life. It's born again Christians change.
 
--
Rick C. Hodgin
Daniel <danielaparker@gmail.com>: Nov 15 02:02PM -0800

On Wednesday, November 15, 2017 at 2:30:52 PM UTC-5, Rick C. Hodgin wrote:
> It wouldn't be Leigh, but new Leigh
 
Doesn't really matter, he'd still get garbage collected in the end.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 15 02:47PM -0800

On Wednesday, November 15, 2017 at 5:03:07 PM UTC-5, Daniel wrote:
> On Wednesday, November 15, 2017 at 2:30:52 PM UTC-5, Rick C. Hodgin wrote:
> > It wouldn't be Leigh, but new Leigh
 
> Doesn't really matter, he'd still get garbage collected in the end.
 
Not so. The salvation of the Lord is to the uttermost:
 
https://www.biblegateway.com/passage/?search=Hebrews+7%3A25&version=KJV
 
Dare I say, "Even one such as Leigh can be saved"? Nay. I say, "Even
one such as Rick, so how much moreso one such as Leigh, for of sinners
I am chief."
 
To the outermost is necessary for each and every last one of us.
 
--
Rick C. Hodgin
"Öö Tiib" <ootiib@hot.ee>: Nov 14 03:36PM -0800

On Wednesday, 15 November 2017 01:19:01 UTC+2, Alf P. Steinbach wrote:
 
> Usually there are better ways.
 
> The situation you describe is a FAQ: <url:
> https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctor-idiom>.
 
Virtuals can't solve the fundamental problem anyway.
In C++ type of object can't change after its creation. Therefore in C++
we can observe three different phases of construction:
1) figure (dynamically) out what is the most derived type that is needed
2) collect together all the required bits and pieces of information for
construction of type determined in 1)
3) construct type determined in 1) using data gathered in 2).
Every of the 3 steps may fail for piles of obvious reasons.
legalize+jeeves@mail.xmission.com (Richard): Nov 15 01:07AM

[Please do not mail me a copy of your followup]
 
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> spake the secret code
>> to complete the construction.
 
>I wouldn't recommend two phase construction in general.
 
>Usually there are better ways.
 
Such as?
 
>The situation you describe is a FAQ: <url:
>https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctor-idiom>.
 
In this case, it's worse than calling virtual functions from a c'tor
because the other class (beta) might attemp to call non-virtual
methods on omega before omega is ready to handle them. We're passing
our this pointer in the member initializer, so other initializers may
not yet have run and certainly the body of the c'tor for omega hasn't
run yet.
 
The FAQ is describing two-phase construction so that calls to virtual
methods in the c'tor will resolve properly.
--
"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>
Paavo Helde <myfirstname@osa.pri.ee>: Nov 15 08:57AM +0200

On 14.11.2017 23:09, Vir Campestris wrote:
> correctly?
 
> In the real code beta handles inter-object communication, and may
> receive signals from other threads.
 
If b does not use omega until later, then it is OK. However, from your
mention of threads I suspect that beta might leak a pointer to omega or
itself to other threads too early, causing all kind of havoc. The rest
of my reply assumes this kind of nasty scenarios.
 
Construction and destruction of multithread-shared objects is always
problematic. Construction is a bit simpler in that one can ensure
relatively easily that an half-constructed object does not become
visible to other threads. This means that the object is exposed to other
threads only after the most derived class constructor has completed
("two-phase construction"), or at least only near the end of the
constructor of the most derived class. The 'sealed' keyword may help to
ensure the class remains the most derived class.
 
If the beta member exposes a pointer/reference of omega to other threads
in its constructor, then this is a big no-no. The other threads must not
know about omega before its constructor has been completed. Otherwise
they may try to access it before completion, or worse yet, after the
omega object has been destroyed by any reason, either during
construction or shortly afterwards. The latter just reflects the fact
that destruction of a thread-shared object is even more problematic than
construction ("an object cannot protect aginst its own destruction").
 
A pretty robust solution is to allocate all thread-shared objects with
std::make_shared() and only pass a std::shared_ptr or std::weak_ptr to
other threads. This forces one to use 2-phase construction, which is
arguably a good thing in this scenario (anything that avoids UB is a
good thing!). As long as a thread has a non-null std::shared_ptr or is
able to construct one from a std::weak_ptr, it is guaranteed that the
full object is alive and can be used properly.
 
An example demoing a factory function doing the two-phase construction:
 
static std::shared_ptr<omaga> omega::CreateOmega(...) {
 
std::shared_ptr<omega> p = std::make_shared<omega>(...);
p->b.NotifyOtherThreads(p);
return p;
 
}
 
Indeed, if you need to fix some "horribly complicated" real code messing
with multithreaded access, then I suggest to refactor it to use
std::shared_ptr in order to enforce proper access. By using raw pointers
or references one must know extremely well what one is doing, which may
not be humanly possible in a messed-up codebase.
 
hth
Paavo
Vir Campestris <vir.campestris@invalid.invalid>: Nov 15 08:50AM

Thanks everyone. I'll continue my discussion with the code's author. I
have a feeling this will be - interesting. I know there's at least one
race condition.
 
Andy
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 15 01:59PM +0100

On 11/15/2017 2:07 AM, Richard wrote:
> run yet.
 
> The FAQ is describing two-phase construction so that calls to virtual
> methods in the c'tor will resolve properly.
 
No. I was mainly responsible for adding that item to the FAQ. It's not
about two phase construction.
 
 
Cheers & hth.,
 
- Alf
legalize+jeeves@mail.xmission.com (Richard): Nov 15 05:11PM

[Please do not mail me a copy of your followup]
 
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> spake the secret code
 
>>> I wouldn't recommend two phase construction in general.
 
>>> Usually there are better ways.
 
>> Such as?
 
This is actually the question I would like answered.
 
The very next answer in the FAQ describes two-phase initialization. I
didn't realize they were separate Q&As at first. I don't think I've
ever looked at this FAQ in this form before. I'm used to the usenet
FAQ that became the book by Marshall Cline.
--
"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>
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 15 07:09PM +0100

On 11/15/2017 6:11 PM, Richard wrote:
 
>>>> Usually there are better ways.
 
>>> Such as?
 
> This is actually the question I would like answered.
 
Then you could read the FAQ that I linked to to answer precisely that
question.
 
For convenience, here's that URL again: <url:
https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctor-idiom>.
 
 
> The very next answer in the FAQ describes two-phase initialization.
 
No, the next answer in the FAQ is about "I'm getting the same thing with
destructors: calling a virtual on my this object from my base class's
destructor ends up ignoring the override in the derived class; what's
going on?"
 
 
> I didn't realize they were separate Q&As at first. I don't think
> I've ever looked at this FAQ in this form before. I'm used to the
> usenet FAQ that became the book by Marshall Cline.
The items in this section are from Marshall's FAQ. It's Marshall's
wording, not mine.
 
Most of ISO C++ FAQ is Marshall's FAQ verbatim.
 
The difference is mostly that Bjarne Stroustrup's FAQ has been
incorporated and that some stuff has been added by the new co-editors,
which are Andrei Alexandrescu, Bjarne Stroustrup and Herb Sutter.
 
 
Cheers & hth.,
 
- Alf
Jorgen Grahn <grahn+nntp@snipabacken.se>: Nov 15 01:57PM

On Tue, 2017-11-14, Öö Tiib wrote:
>> I don't find myself writing a lot of such code.
 
> That can be because the problem domain you deal with does not need
> flags.
 
Yes (I elaborated a bit in a later posting) or maybe we solve the same
problems in drastically different ways.
 
It would be interesting to learn which is the main reason people
disagree on design issues.
 
> inefficient compared to std::bitset<256> that takes fixed 32 bytes,
> and without trees and dynamic allocations provides effectively
> exactly same functionality.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
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: