Tuesday, September 20, 2016

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

woodbrian77@gmail.com: Sep 19 05:43PM -0700

On Monday, September 19, 2016 at 4:18:44 PM UTC-5, Mr Flibble wrote:
> };
> } instance;
 
> int main() {}
 
That's a mess compared to a "Hello, World" that uses main().
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
David Brown <david.brown@hesbynett.no>: Sep 20 08:44AM +0200

>> } instance;
 
>> int main() {}
 
> That's a mess compared to a "Hello, World" that uses main().
 
I don't think Mr. Flibble was suggesting it was a good idea to replace
main() with the constructor of a static object - merely that it is
/possible/ to do so. In particular, such constructors let you do useful
work before main() is called, and it is possible that an issue in such
constructors means that main() is /never/ called.
 
And in a freestanding environment, the toolchain can happily have no
main() function (the "main" function can have any name), and you may
have many methods for calling code before a "main" function is run.
"Öö Tiib" <ootiib@hot.ee>: Sep 20 04:45AM -0700

On Tuesday, 20 September 2016 09:44:40 UTC+3, David Brown wrote:
> /possible/ to do so. In particular, such constructors let you do useful
> work before main() is called, and it is possible that an issue in such
> constructors means that main() is /never/ called.
 
Neither woodbrian nor Flibble wrote if it is good or bad idea.
Flibble seemingly wrote that it is possible and woodbrian
seemingly wrote that it has messy style. IMHO it is an idea
to avoid.
 
Calling order of such static object (and static data member
object) constructors is defined only within single compilation
unit that defines those. In project that matters there are lot of
compilation units. So when the statics are defined in several
compilation units and the initialization order matters then
things will become quite hairy.
 
The reasons how that order matters may pop up in late stages
of development and the "best" idioms of dealing with such
fiasco (like Schwarz counter) look quite confusing and will
result with pointless code generated. Additionally such
statics are source of synchronization issues and later there
can be destruction order fiasco as well. ;)
 
So I typically try to avoid the statics. When these are
unavoidable then I try to make these with maximally
lightweight and independent construction. When more
sophisticated initialization is needed then I try to dodge
it by adding lazy or explicit additional initialization steps
that will run after 'main' is called.
 
 
> And in a freestanding environment, the toolchain can happily have no
> main() function (the "main" function can have any name), and you may
> have many methods for calling code before a "main" function is run.
 
C++ standard has seemingly no good policy for choosing
what belongs into freestanding library and what does not.
It seems to require more than needed; also there are no
mechanism of indicating optional features. As result what
is "freestanding" feels incomplete and inconsistent. In
practice it is some non-conforming slice of C++ and so
it is hard to build any arguments upon it.
David Brown <david.brown@hesbynett.no>: Sep 20 03:08PM +0200

On 20/09/16 13:45, Öö Tiib wrote:
 
> compilation units. So when the statics are defined in several
> compilation units and the initialization order matters then
> things will become quite hairy.
 
Yes indeed. It would be nice if there had been more control over this,
but I understand where the limitation comes from. (It would also have
been nice if it were possible to declare function-static objects, but
have them constructed/initialised before main() rather than when first
used.)
 
Even compiler extensions (such as gcc's init_priority attribute) leave
something to be desired - it uses numbers, and has no way to say
"initialise this object before that one" or "initialise that object
before this one".
 
It would all be much easier if the compiler could handle this better.
Perhaps compilers could spot common idioms (such as returning a
reference to a static object) and turn them into carefully ordered
pre-main initialisation.
"Öö Tiib" <ootiib@hot.ee>: Sep 20 07:37AM -0700

On Tuesday, 20 September 2016 16:09:14 UTC+3, David Brown wrote:
> something to be desired - it uses numbers, and has no way to say
> "initialise this object before that one" or "initialise that object
> before this one".
 
Also it AFAIK does not affect initialization order between different
shared libraries. It is comical how so lot of things use modules
written in C++ while C++ lacks a concept of modules whatsoever.
 
> Perhaps compilers could spot common idioms (such as returning a
> reference to a static object) and turn them into carefully ordered
> pre-main initialisation.
 
You probably did mean linker here. I would be happy even with
diagnostic that whatever order it mechanically picked results with
usage of not yet constructed object.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 20 06:34PM +0100

On 20/09/2016 12:45, Öö Tiib wrote:
> compilation units. So when the statics are defined in several
> compilation units and the initialization order matters then
> things will become quite hairy.
 
[snip]
 
But if you only have one such static object in your program then there
is no problem: you could use Meyers' Singleton for other objects.
 
/Flibble
David Brown <david.brown@hesbynett.no>: Sep 20 07:35PM +0200

On 20/09/16 16:37, Öö Tiib wrote:
 
> Also it AFAIK does not affect initialization order between different
> shared libraries. It is comical how so lot of things use modules
> written in C++ while C++ lacks a concept of modules whatsoever.
 
One day, we will have proper modules in C++. I believe both clang and
MSVC have experimental module systems (I was going to say "module
concepts", but that would add to confusion with another overdue feature
of C++). But until one of these, or a combination, is picked as the
standard, it is not possible to work with them for anything more than
experimentation.
 
 
> You probably did mean linker here. I would be happy even with
> diagnostic that whatever order it mechanically picked results with
> usage of not yet constructed object.
 
I really meant "toolchain", as I suspect this would need support from
both the compiler and the linker.
 
Certainly a useful diagnostic that things are not as you want them to be
is much better than silently wrong code!
"A. Bolmarcich" <aggedor@bitbucket.net>: Sep 20 06:54PM

> red.
 
>> However, Wirth rewrote it in Modula-2 or Oberon (I don't remember which of
>> these two languages), and that version is available.
 
About ten years after "Algorithms + Data Structures = Programs" was
published, a new edition was published with the title "Algorithms &
Data Structures". According the to Preface of the new edition: "The
major change which prevades the entire text concerns the programming
language used to express the algorithms. Pascal has been replaced by
Modula-2."
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Juha Nieminen <nospam@thanks.invalid>: Sep 20 06:03AM

> What will Hell feel like?
 
When will you get into your thick skull that your words have no magic
powers, even though in your delusions you think they have? You quoting
scripture will not magically influence people. They are just empty
words.
 
Why do you keep making these posts? Because it feeds your own
self-righteousness, you hypocrite.
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Sep 20 07:30AM -0700

On Tuesday, September 20, 2016 at 2:03:35 AM UTC-4, Juha Nieminen wrote:
> > What will Hell feel like?
 
> When will you get into your thick skull that your words have no magic
> powers,
 
I have no power whatsoever. I cannot even teach people those things I
am espousing. It comes from within as God changes the person so that
they themselves will then know that what I am espousing is the truth.
 
It is not me convincing anyone, but it is me speaking the truth so that
those whom God has changed will know within themselves, as by the very
imparting of the knowledge of God and of the truth of His Son Jesus
Christ, that they are a sinner, that they need to be forgiven, and that
only Jesus Christ can forgive them.
 
I speak the truth to you and everyone else. It is not my job to make
you believe it. It is only my job to speak it accurately.
 
> even though in your delusions you think they have? You quoting
> scripture will not magically influence people. They are just empty
> words.
 
Consider your position alongside the teachings of Jesus Christ:
 
http://biblehub.com/kjv/john/6.htm
 
63 It is the spirit that quickeneth; the flesh profiteth nothing:
the words that I speak unto you, they are spirit, and they are
life.
64 But there are some of you that believe not. For Jesus knew from
the beginning who they were that believed not, and who should
betray him.
65 And he said, Therefore said I unto you, that no man can come
unto me, except it were given unto him of my Father.
 
It is not me, Juha. I point you not to me, not to a church, not to a
denomination, but to Jesus Christ Himself. I point you to truth, and
I ask you to investigate it ALL for yourself.
 
You do not need me or anyone else to teach you these things, but they
are all before you if you will only pursue them. God has given us the
Bible, and protected it, so that we can have a solid foundation upon
which to return, so that His Holy Spirit aligns with the word He has
given us, because Satan can also appear as an angel of light and leads
many people falsely who think they are following after God, but are
not. But by verifying our actions with the counsel of many, and holding
those actions to the guidance of scripture and the counsel of many, we
can be assured that we are moving as we should.
 
> Why do you keep making these posts? Because it feeds your own
> self-righteousness, you hypocrite.
 
Because I have a burden for the lost souls of this world. Hell is a
place of ongoing fiery torment that will never end. It is a containment
system for those who are not operating in truth, but are operating in
in sin, in falseness.
 
We are all eternal beings, and we will endure on to eternity. My purpose
in writing all of this is so you will continue to shine and thrive in
eternity. That you will prosper greatly ongoingly. I do not want the
end of you to come in the fiery place of torment. I want you to have the
full future God has carved out for you, if you will receive it.
 
In a sentence: I have a love for you (and others) because God's love is
real, and has changed me, and now lives and dwells within me.
 
It is that love God has for His creation which resides in me. And it is
from within that love that I move, because His burden is unto you and
your eternal soul, and this has now also become my burden because He has
redeemed me, and His Holy Spirit dwells within me.
 
Jesus said:
 
http://biblehub.com/kjv/revelation/3-20.htm
20 Behold, I stand at the door, and knock: if any man hear my voice,
and open the door, I will come in to him, and will sup with him,
and he with me.
 
It's very difficult to ignore a knocking on the door from within a house
or apartment. Jesus is constantly knocking upon your life, your mind,
your soul, your thoughts. He is there in the world, in the beauty, in
the love, in the things done in truth, out of kindness and generosity,
and He is there in the words I speak, and those others like me speak when
we point you to Him.
 
He stands at the door and knocks, and will receive everyone who opens the
door and receives Him.
 
He is God Almighty, with all possessions of the entire universe under His
control and command. And the Bible teaches us that we will be married to
Him in eternity, such that His possessions will also be our possessions,
as it is here on Earth after the manner of marriage, where all that's hers
becomes his, and all that's his becomes hers, the Earthly pattern of the
eternal marriage to Jesus Christ by the collective church.
 
It has been God's plan from the beginning. And it will endure forever.
It is a plan well executed. And all who will be saved will be with Him,
possessing also the entire universe as their own. And all who have
rejected truth, rejected Him, will be contained in the place of fiery
torment, where they can no longer interact with the rest of God's creation,
for they in their sin and falseness are as a cancer unto truth, tearing it
down continually, replacing solid foundations with diseased weakness.
 
-----
I posted in the comp.lang.c group just now (slightly redacted):
 
You have value. Your worth is measured as being well above that
of finest purest gold. I want you to continue on after you leave
this world, shining and thriving forever. I want your future to
be secure that you may prosper greatly. Jesus makes it possible.
 
It is my prayer for you, and for everyone in this group.
-----
 
It is my ongoing prayer for you, and for many others. All the people I
encounter in my life actually. Even my "enemies." God's love living
inside of me makes it possible. It is not a Rick-thing, but it is the
life God has given me through Jesus Christ welling up unto this ongoing
outpouring of love and prayer from within the hope I now have assurance
of through Him.
 
It is ALL God. It is not me. I too am just a recipient. But what He
has given me is available to each of you. All you have to do is seek
the truth, and you too will discover what I have found. And my prayer
is that you will do even more for His Kingdom than I have done, that
you will outshine me so that you might even encourage me to do more.
 
Best regards,
Rick C. Hodgin
Tim Rentsch <txr@alumni.caltech.edu>: Sep 19 06:23PM -0700


> Well, after checking around it seems to me that it's likely I was
> wrong about 16-bit `wchar_t` being invalid for Unicode.
 
> So, punch me.
 
I have no complaints with any of your comments. You were
conveying a result that was true to the best of your
understanding. Indeed it may very well have proven to be true.
I certainly am not an expert in the C++ standard, so I asked
about it, that's all. No one should be faulted for not knowing
all the myriad implications of the C++ standard, which is a
daunting document, and I didn't mean to imply anything along
those lines.
 
> But I don't know that, and it's certainly not my private opinion: I
> got it from others, that I thought were experts in the area: a ?fact?
> that I was pretty sure of.
 
Yes, that was my impression, and I appreciate that you did. My
question was meant only as a question.
 
 
> <url:
> http://stackoverflow.com/questions/39548465/is-16-bit-wchar-t-formally-valid-for-representing-full-unicode>
 
> Hopefully some convincing answers will be forthcoming there.
 
Excellent! I will take a look.
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: