Monday, June 21, 2021

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

Paavo Helde <myfirstname@osa.pri.ee>: Jun 21 09:22AM +0300

21.06.2021 00:56 Chris M. Thomasson kirjutas:
>> penalties, whereas extra pointers or extra dynamic allocations
>> involved with std::shared_ptr only cost peanuts.
 
> What is std::atomic_ptr?
 
Sorry, I meant std::atomic<int>.
 
 
> You have some issues with your memory order here, relaxed is not going
> to cut it. Also, better try to isolate the refcount on a cacheline, and
> pad it.
 
In my test, each refcount is a part of a data object which contains a
256-byte array, so I would say they are isolated pretty well.
 
If you know how to make the atomic faster, I'm all for it.
Paavo Helde <myfirstname@osa.pri.ee>: Jun 21 09:52AM +0300

21.06.2021 02:03 Sam kirjutas:
> shared_ptr's innards what does one find, but an _Atomic_word, whose
> operations use acquire/release memory ordering which, according to the
> above, should impose a heavy penalty.
 
What? Surely the std::shared_ptr must contain thread synchronization,
most probably in the form of an atomic. This is also visible from the
timings, the std::shared_ptr timings are very similar to std::atomic.
And yes, both involve heavy penalty when compared to non-synchronized
single-threaded refcount (in case when each refcounted object is only
accessed in a single thread like in my test).
 
> Something in your observed results does not add up, in this respect.
 
Not sure what you mean. You said that you would be surprised if making
the refcounter atomic would add any measurable overhead, and now you are
surprised indeed. I do not see any contradiction :-)
Juha Nieminen <nospam@thanks.invalid>: Jun 21 12:39PM

>> My condolences.
 
> No condolescences are mine ... to those who have to use C++17 and so their
> code is formally full of undefined behaviors.
 
Are you implying that if you say "g++ -std=c++14" the compiler will do
something wildly different than if you say "g++ -std=c++17" because
the latter allows it to do whatever it wants with UB code?
Juha Nieminen <nospam@thanks.invalid>: Jun 21 12:43PM


>> OK, I'm confused. What used to be defined behavior that is now UB?
 
> Basically lot of things with pointer-interconvertibility, constexpr and
> strengthening several implementation-specified to undefined.
 
I think a practical example would have illustrated this better.
 
And by practical example I don't mean "an artificially constructed example
which works in C++14 and C++17 identically anyway, but is theoretically
"undefined behavior" in the latter".
 
I mean a *practical* example, of realistic code. Preferably something
where "g++ -std=c++17" or "clang++ -std=c++17" does something different
and undesirable compared to if you had specified "-std=c++14".
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jun 21 10:48PM +0100

On Mon, 21 Jun 2021 12:43:26 +0000 (UTC)
Ju> I think a practical example would have illustrated this better.
 
> I mean a *practical* example, of realistic code. Preferably something
> where "g++ -std=c++17" or "clang++ -std=c++17" does something different
> and undesirable compared to if you had specified "-std=c++14".
 
One practical example is what your contract says. If it requires your
code to work with portable standard-conforming C++ and not just with a
particular version of g++ then the switch has a practical consequence.
 
C++17 was a poor standard, only partly remedied by C++20. Someone else
not involved in this list has already persuaded me that my naive
understanding that in C++20 you could iterate over the memory of any
trivial (C-like) object by unsigned char* with defined behaviour,
which is a very widestpread practice in C++ and allowed by C, or even
implement std::memcpy in standard C++, was wrong. What a nonsense.
David Hilvert <dhilvert@gmail.com>: Jun 21 12:03PM +0200

General AI is now solved. The Caltech round of
the discussion included the point that the IBM
C++ compiler under OS/2 is a 4th generation
language.
 
You'll need the Slashdot instructions for
setting ownership and permissions.
 
https://m.slashdot.org/submission/13973856
 
 
----Android NewsGroup Reader----
https://piaohong.s3-us-west-2.amazonaws.com/usenet/index.html
"Öö Tiib" <ootiib@hot.ee>: Jun 21 03:27AM -0700

On Monday, 21 June 2021 at 13:04:13 UTC+3, David Hilvert wrote:
> General AI is now solved.
 
Seems full nonsense sentence. Something like "Ubiquitous ROI
is now incubated."
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Jun 21 12:42PM


> You'll need the Slashdot instructions for
> setting ownership and permissions.
 
> https://m.slashdot.org/submission/13973856
 
Will look it up...
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Jun 21 12:44PM

>> setting ownership and permissions.
 
>> https://m.slashdot.org/submission/13973856
 
> Will look it up...
 
Some script...
Real Troll <real.troll@trolls.com>: Jun 21 04:40PM

On 21/06/2021 11:03, David Hilvert wrote:
> General AI is now solved.
 
 
What was the problem that is now solved? Can you give a brief summary here.
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: