Sunday, November 17, 2019

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

Keith Thompson <kst-u@mib.org>: Nov 12 03:54PM -0800

> I installed gcc10 on a FreeBSD 12.1 machine. That machine also has
> gcc9.2 on it. When I try to use g++10, I get an error that
> it cannot execute 'cc1plus' execvp: No such file or directory
 
How did you install gcc10?
 
I'm not very familiar with FreeBSD, but on some systems "gcc" and "g++"
are separate packages. cc1plus is the C++ frontend, invoked by the g++
command. It's typically installed under a "libexec" directory, so g++
can find it but it's not in your $PATH. If you installed gcc-10 with
support for C but not for C++, that could explain what you saw -- except
that the "g++10" command itself probably shouldn't have been visible.
 
This might be a better question for a Unix or FreeBSD forum.
 
[...]
 
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 16 06:40PM -0800

On 11/16/2019 2:13 PM, Scott Lurndal wrote:
 
> The purpose of the test was to see what happened when all cores contended
> for the same line (running slow is expected, crashing (which we didn't) isn't).
 
> Actual lab codes were much better structured from a parallelism standpoint.
 
It should not crash, slowing to a crawl is expected.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 17 09:17AM +0100

>> ment to be portable.
 
> Nonsense. What is aligned or misaligned is up to compiler
> itself to decide. ...
 
We're not talking about certain implementations but the language.
And unaligned accesses simply aren't portable.
 
 
> More nonsense. Nothing in standard says that all objects of type
> std::atomic<T> are aligned in a way that reads and writes to those
> objects can be made lock free.
 
You can't read. I did say:
1. All complete types have a natural alignment.
2. std::atomic<T> thereby has also a natural alignment.
3. is_lock_free couldn't be dynamic because of runtime alignment
properties because C++ doesn't support unaligned acceses anyway.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 12 11:24AM +0100

> Can anyone tell me whether std::atomic<T>::is_lock_free() isn't static
> as well as constexpr? Having it non-static as well as non-constexpr
> doesn't make sense for me.
 
Someone on Stack Oveflow told me this: an atomic value might be un-
aligned so that access might be not atomic. So the compiler can't say
at compile-time whether the access can be atomic. But there's a static
constexpr bool called std::atomic<T> ::is_always_lock_free.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 12 02:11PM +0100

> aligned so that access might be not atomic. So the compiler can't say
> at compile-time whether the access can be atomic. But there's a static
> constexpr bool called std::atomic<T> ::is_always_lock_free.
 
On the other side I can't believe this because the language says that
unaligned accesses have undefined behaviour; so there must be another
reason for the distinction between is_lock_free and is_always_lock_free.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 12 03:14PM -0800

On 11/12/2019 1:54 AM, Bonita Montero wrote:
> Can anyone tell me whether std::atomic<T>::is_lock_free() isn't static
> as well as constexpr? Having it non-static as well as non-constexpr
> doesn't make sense for me.
 
Take a deep look at the following macros:
 
https://en.cppreference.com/w/c/atomic/ATOMIC_LOCK_FREE_consts
Bonita Montero <Bonita.Montero@gmail.com>: Nov 12 02:39PM +0100


> On the other side I can't believe this because the language says that
> unaligned accesses have undefined behaviour; so there must be another
> reason for the distinction between is_lock_free and is_always_lock_free.
 
Although I was pretty confident that C++ doesn't make the decision
between is_lock_free and is_always_lock_free because of the alignement
I wrote a little program to check this. I've got installed Visual Studio
with compilers for the Windows-platforms for ARMv8-CPUs. And ARMv8 is
able to do unaligned memory-accesses but compare & exchange etc. is
mandated to be aligned. So I thought that when I call is_lock_free on
a pointer to an atomic is_lock_free wouldn't simply return true of for
each atomic but only if the atomic is properly aligned. So I wrote a
little function to check this:
 
#include <atomic>
#include <cstddef>
bool isLockFreeAtomic( std::atomic<std::uint64_t> *a64 )
{
return a64->is_lock_free();
}
 
When I compile this with assembly-output I get the following code:
 
|?isLockFreeAtomic@@YA_NPAU?$atomic@_K@std@@@Z| PROC
movs r0,#1
|$M12|
bx lr
ENDP
 
So it's like I expected: the runtime-lib doesn't check the pointer.
So there must be another reason why there's a decision between
is_lock_free and is_always_lock_free.
Bo Persson <bo@bo-persson.se>: Nov 12 04:46PM +0100

On 2019-11-12 at 14:39, Bonita Montero wrote:
 
> So it's like I expected: the runtime-lib doesn't check the pointer.
> So there must be another reason why there's a decision between
> is_lock_free and is_always_lock_free.
 
It might just be for historic reasons. In C++14 we only have the
function and it is speced:
 
Returns: True if the object's operations are lock-free, false otherwise.
 
It said nothing about whether different objects of the same type always
returned the same value.
 
 
In C++17 we also got is_always_lock_free, where *always* is important,
and the function is now supposed to return the same value (says a
non-normative comment...).
 
 
 
Bo Persson
Bonita Montero <Bonita.Montero@gmail.com>: Nov 12 05:40PM +0100

> Returns: True if the object's operations are lock-free, false otherwise.
> It said nothing about whether different objects of the same type always
> returned the same value.
 
There's no logical reason why they should.
Bo Persson <bo@bo-persson.se>: Nov 12 08:23PM +0100

On 2019-11-12 at 17:40, Bonita Montero wrote:
>> It said nothing about whether different objects of the same type
>> always returned the same value.
 
> There's no logical reason why they should.
 
So therefore we now also have the member is_always_lock_free. :-)
 
In my previous post I a bit hastily stated that the functions always
return that value, but in reality that is only true if the value *is* true.
 
When is_always_lock_free is false, the functions just *might* return
true in some cases and false in others.
 
Just to make it more complicated, there are also macros for some types,
like ATOMIC_INT_LOCK_FREE (which can have the value "sometimes lock
free" :-).
 
 
Bo Persson
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 12 03:21PM -0800

On 11/12/2019 11:23 AM, Bo Persson wrote:
 
> Just to make it more complicated, there are also macros for some types,
> like ATOMIC_INT_LOCK_FREE (which can have the value "sometimes lock
> free" :-).
 
Indeed! The atomic types are allowed to be created using locks or even
obstruction free constructs:
 
All lock-free is obstruction free, but not all obstruction free is
lock-free... ;^)
Nikki Locke <nikki@trumphurst.com>: Nov 14 11:23PM

Available C++ Libraries FAQ
 
URL: http://www.trumphurst.com/cpplibs/
 
This is a searchable list of libraries and utilities (both free
and commercial) available to C++ programmers.
 
If you know of a library which is not in the list, why not fill
in the form at http://www.trumphurst.com/cpplibs/cppsub.php
 
Maintainer: Nikki Locke - if you wish to contact me, please use the form on the website.
Real Troll <Real.Troll@Trolls.com>: Nov 14 12:15PM -0400

<https://herbsutter.com/2019/11/09/trip-report-autumn-iso-c-standards-meeting-belfast/>
 
Bo Persson <bo@bo-persson.se>: Nov 16 11:59PM +0100

On 2019-11-16 at 22:35, Öö Tiib wrote:
> on shoulders of companies that are more than 35 years old (and people
> who are more than 35 years old). In effort to modernize COBOL it was
> AFAIK standardized to be object-oriented since 2002.
 
And not only bookkeeping. :-)
 
I recently worked for a bank with about 500 COBOL developers doing all
the heavy data lifting.
 
Even when you have a smart phone app accessing a server written in Java,
the Java code will send all the transactions to the COBOL back end for
validation and data base accesses.
 
This doesn't show up in the Tiobe index, because it is all closed source
and the 50 year old developers don't ask COBOL questions on any net
forum. :-)
 
 
Bo Persson
David Brown <david.brown@hesbynett.no>: Nov 17 12:06AM +0100

On 16/11/2019 22:27, Melzzzzz wrote:
 
> Delphi is for small one shot projects... usefull for single developer
> when she wants to deliver fast. Used C++ Builder in 90es. Served it's
> purpose...
 
It is - and perhaps that is mostly the case. But it is also used in
some massive projects (I know of a few). When it came out, the only
serious RAD tool for Windows was Visual Basic. There was nothing
remotely similar for C++. If you wanted to be able to make a GUI
program for Windows without a great deal of manual labour, and you
wanted a strongly typed, structured compiled programming language,
Delphi was your tool of choice.
 
Its heyday has long past, but projects often have history - there are a
lot of programs that continue to be developed in Delphi simply because
they were originally developed in Delphi. It is a lot less common as a
choice for new software projects.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 17 09:11AM +0100

> COBOL is massively relevant - even today.
 
When I check sites that offer jobs I find two magnitudes more offers
for Java-developers than for COBOL-developers (C++ has almost vanished).
Bonita Montero <Bonita.Montero@gmail.com>: Nov 17 09:12AM +0100

>> that he might like since he had done a lot of parallel code.
 
> No, you didn't.  There are many ways to describe you based on your
> postings - "stupid" is not one of them.
 
You can't read my mind.
Bo Persson <bo@bo-persson.se>: Nov 17 09:40AM +0100

On 2019-11-17 at 09:11, Bonita Montero wrote:
>> COBOL is massively relevant - even today.
 
> When I check sites that offer jobs I find two magnitudes more offers
> for Java-developers than for COBOL-developers (C++ has almost vanished).
 
That's because you can get Java-developers just out of school by putting
out job ads.
 
The COBOL guys are mostly older and not particularly looking for new
jobs - so not reading the ads anyway. If you want to find one, you have
to head-hunt.
 
 
Making lots of noise on the internet isn't the best measure of popularity.
 
 
 
Bo Persson
Sam <sam@email-scan.com>: Nov 16 08:08PM -0500

Bonita Montero writes:
 
 
>>> I know different heap-allcoation-strategies.
 
>> Sure, everyone believes you.
 
> Slogans like from the scoolyard ...
 
Right. I clearly remember how everyone in the schoolyard always pretended to
be experts on heap allocation strategies.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 17 01:10AM

On 17/11/2019 01:08, Sam wrote:
 
>> Slogans like from the scoolyard ...
 
> Right. I clearly remember how everyone in the schoolyard always pretended
> to be experts on heap allocation strategies.
 
Hmmm, I wonder if emoji works on Usenet. Lets find out:
 
🤣
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into
snakes." - Rick C. Hodgin
 
"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," Byrne 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."
Ian Collins <ian-news@hotmail.com>: Nov 17 02:31PM +1300

On 17/11/2019 14:10, Mr Flibble wrote:
>> to be experts on heap allocation strategies.
 
> Hmmm, I wonder if emoji works on Usenet. Lets find out:
 
> 🤣
 
💩
 
--
Ian.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 17 09:18AM +0100


>> Slogans like from the scoolyard ...
 
> Right. I clearly remember how everyone in the schoolyard always
> pretended to be experts on heap allocation strategies.
 
I was talking about you, and you know that.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 17 01:54AM

Hi!
 
Possibly related to the Ballmer Peak but I have had a whole bottle of Cava
whilst coding and I haven't felt drunk at all. Does the body/brain
metabolize alcohol faster if you aren't just thinking about if Brazil is a
good film or not?
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into
snakes." - Rick C. Hodgin
 
"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," Byrne 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."
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 17 12:00AM

Hi!
 
The neoGFX C++ support library "neolib" now features polymorphic variants
which work with std::visit!
 
A polymorphic variant is a variant of types that have abstract interfaces
and the variant itself also has an abstract interface allowing variants to
be used across a plug-in boundary (plug-ins are similar to Microsoft's COM
DLLs).
 
https://github.com/i42output/neolib/blob/master/include/neolib/i_plugin_variant.hpp
https://github.com/i42output/neolib/blob/master/include/neolib/plugin_variant.hpp
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into
snakes." - Rick C. Hodgin
 
"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>: Nov 17 01:18AM +0100

On 17.11.2019 01:00, Mr Flibble wrote:
> similar to Microsoft's COM DLLs).
 
> https://github.com/i42output/neolib/blob/master/include/neolib/i_plugin_variant.hpp
 
> https://github.com/i42output/neolib/blob/master/include/neolib/plugin_variant.hpp
 
Polymorphic variants are nice.
 
Is it possible to sort of factor that out of neoGFX?
 
- Alf
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: