Thursday, November 21, 2019

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

Bonita Montero <Bonita.Montero@gmail.com>: Nov 16 07:27PM +0100


> Not in this reality. Standard has fully left it up to implementation
> to decide if alignment of say int member in a particular struct is 1
> or 2 or 4 or 8 and why.
 
I didn't say any contrary.
 
> Seems that you don't know standard and also you don't know any
> use cases for packed structs and therefore wiggle pathetically.
 
You can't even read what I said.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 16 01:55PM -0800

On 11/16/2019 10:07 AM, Scott Lurndal wrote:
>> L2 cache line! Well, on x86 this should trigger a system wide bus lock
>> for legacy reasons.
 
> Yes, that's the "very time consuming" part.
 
Indeed. A forced unaligned atomic access wrt hacking RCU was amortized
and used on a fairly rare basis. Think along the lines of read-"mostly"
usage patterns. Wrt RCU, we can collect garbage on a per-thread basis,
and when a threads garbage gets over a "threshold", it can decide to
execute a system wide membar, or something else. The asymmetric side of
things is to have a fast side, and a slow side... The fast are the
readers, the slow is the writers. Readers can run full steam ahead, and
do not interfere with writers.
 
> systems consisting of commodity 1u or 2u rack mount SMP boxes).
 
> One of the national labs was benchmarking the system by pounding on
> a spinlock from all 128 cores (across 16 2-socket nodes).
 
YIKES! Hammer time. ;^)
 
> workloads on the system).
 
> [*] The chip had 2MByte of DRAM caching remote lines, a miss cost about
> 800 ns round trip (using DDR IB) on the HT systems, and 500ns on QPI (using QDR IB).
 
Did you try using hash tables just to experiment wrt taking pressure off
of a single lock? Even that does not scale all that great. However, its
better than a single funnel... ;^)
scott@slp53.sl.home (Scott Lurndal): Nov 15 09:47PM


>> Tell me of the sense to use non-aligned atomics.
 
>Not sure what that even means. Are you talking about L2 cache alignment
>and proper padding? Its used to avoid false sharing.
 
Why do you bother with BM? It deliberatly removes attributes so
it's impossible to see who said what to whom.
 
In any case, unaligned atomics are useless, and many architectures
won't support them (particularly in uncachable memory regions like
those mapped to PCI express bars (and PCI express endpoints -may- support atomic
operations...)).
 
I suspect that most architectures avoid supporting unaligned atomics
because they might split cache lines which would make it impossible
(or very time consuming) to support atomic semantics for the access.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 15 01:56PM -0800

On 11/15/2019 1:47 PM, Scott Lurndal wrote:
>> and proper padding? Its used to avoid false sharing.
 
> Why do you bother with BM? It deliberatly removes attributes so
> it's impossible to see who said what to whom.
 
I think BM = JG. Its a sock puppet...
 
 
> I suspect that most architectures avoid supporting unaligned atomics
> because they might split cache lines which would make it impossible
> (or very time consuming) to support atomic semantics for the access.
 
Well, I remember abusing unaligned atomics such that a word straddles a
L2 cache line! Well, on x86 this should trigger a system wide bus lock
for legacy reasons. It did something quite interesting. It acted like a
remote memory barrier that makes it possible to implement asymmetric
sync algorithms. There is a mention of it, need to find it. They called
it something like QPI? Humm... Let me do a little search...
 
[searching]
 
Found it!
 
https://blogs.oracle.com/dave/qpi-quiescence
 
This is very hackish, but does allow for RCU. Also, fwiw, Windows has an
interesting instruction:
 
https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-flushprocesswritebuffers
 
That can provide a similar behavior. Iirc, it sends IPIs to an affinity
mask of processors. This can be done in the Kernel with Windows. It
takes a device driver.
Melzzzzz <Melzzzzz@zzzzz.com>: Nov 16 11:08PM

> 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.
 
For what is worth, I think that Delphi is most used in eastern
countries... Russia come to my mind...
 
 
--
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala
Wisdom90 <d@d.d>: Nov 16 02:54PM -0500

On 11/16/2019 1:32 PM, Bonita Montero wrote:
>> source, but check it too see Delphi there on top of go, rust,
>> TypeScript, Scala, Dart, Visual Basic, etc)
 
> Delphi is about as relevant as COBOL. ;-)
 
 
Hello,
 
 
Five reasons to learn Delphi
 
https://jonlennartaasenden.wordpress.com/2019/02/08/5reasons/
 
 
Thank you,
Amine Moulay Ramdane.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 16 07:32PM +0100

> very common in the "world" of Embarcadero (the company that currently
> own those tools). Why is very common? Because the GUI libraries (VCL and
> FireMonKey) that are used by C++ Builder are built with Delphi.
 
Ok, that might be right. But you usually write code on your own which
mixes Delphi and C++ in the same project.
> world of software development (I know, the TIOBE index is not best
> source, but check it too see Delphi there on top of go, rust,
> TypeScript, Scala, Dart, Visual Basic, etc)
 
Delphi is about as relevant as COBOL. ;-)
Bonita Montero <Bonita.Montero@gmail.com>: Nov 16 07:30PM +0100

> Bonita specifically started the thread "Task for Amine", in order to
> insult the guy, and start a "fight" thread.
 
No, that's not a fight. I thought he could be encouraged to write his
code in a language which is more accepted and write code for a problem
that he might like since he had done a lot of parallel code.
Cholo Lennon <chololennon@hotmail.com>: Nov 16 03:09PM -0300

On 11/16/19 1:31 PM, Bonita Montero wrote:
> and will never be relevant in the world of sw-development. At the time
> when Delphi hit the market, the train for Pascal-derivatives had already
> come to an end.
 
Mixing Delphi and C++ (C++ Builder) is not a crazy idea. Actually it is
very common in the "world" of Embarcadero (the company that currently
own those tools). Why is very common? Because the GUI libraries (VCL and
FireMonKey) that are used by C++ Builder are built with Delphi. The
interoperability between both languages is really easy if you follow
some simple rules... just compile with one compiler and use it with the
other (of course, there a lot of C++ features that cannot be used in
Delphi).
 
Last but not least, accept it or not: Delphi is still relevant in the
world of software development (I know, the TIOBE index is not best
source, but check it too see Delphi there on top of go, rust,
TypeScript, Scala, Dart, Visual Basic, etc)
 
Regards
 
--
Cholo Lennon
Bs.As.
ARG
David Brown <david.brown@hesbynett.no>: Nov 16 09:55PM +0100

On 16/11/2019 19:32, Bonita Montero wrote:
>> source, but check it too see Delphi there on top of go, rust,
>> TypeScript, Scala, Dart, Visual Basic, etc)
 
> Delphi is about as relevant as COBOL. ;-)
 
COBOL is massively relevant - even today. I am not convinced by the
estimates I have read of the quantity of COBOL code written in recent
years, but even if they are out by a couple of orders of magnitude,
COBOL is still a huge industry and a major programming language.
 
In the same vein, Delphi is a major language / development tool, with a
very large base in commercial companies. It is relatively small in the
world of open source, sourceforge, github, etc., and so on. When you
are using close source software on Windows, you won't know it is written
in Delphi - but it might well be.
 
And yes, there is plenty of software that mixes C++ and Delphi.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 15 05:17PM +0100

>>> for yourself.
 
>> Read the complete thread before you post!
 
> Unfortunately, I did.
 
If you did the above answer would be senseless.
 
> does about its business? And after you figure that out, I'm sure you'll
> be curious enough to know the precise semantics down to the transistor
> level.
 
It's a normal heap-allocation.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 15 06:56PM +0100


>> If you did the above answer would be senseless.
 
> It's not my fault you lack the minimal capacity to understand its
> brilliance.
 
Another time: if you had read that I quoted a part of the LLVM-website
your posting would be gratuitous.
 
 
>> It's a normal heap-allocation.
 
> Yes, but how does that work? I guess you don't know the answer to that,
> and that frustrates you. Too bad.
 
Doesn't matter. I asked just to know if the throwing might fail because
the exception-object couldn't be created. There are several heap-alloca-
tion-strategies which are all equally appropriate for this purpose.
Heap-allocation is a different topic.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 15 01:47PM -0800

On 11/13/2019 8:59 AM, Bonita Montero wrote:
> Can anyone tell me what would be a proper way to allocate storage
> for an exception-object being thrown without causing that this
> allocation might fail?
 
Sometimes, exceptions are banned for certain environments for good reasons.
 
 
> And remember that these objects even have
> to live longer than a thread because you might refer to it by
> an std::exception_ptr.
 
This is completely up to the implementation. They can store/do things
however they want to, as long as it complies to the std. Damn, JG, how
many exceptions would have to be nested to exhaust memory in a thread
such that throw has nothing left? You know the answer right?
 
I remember doing an excepting thing in C basically abusing
setjmp/longjump. It used TLS.
 
Better to ask in a compiler group. For instance, I found some odd things
going on in pellesc. Asked over there, and received extremely
informative answers. Well, they said they might get fixed in the next
release. Okay, good enough. :^)
Sam <sam@email-scan.com>: Nov 15 05:18PM -0500

Bonita Montero writes:
 
> the exception-object couldn't be created. There are several heap-alloca-
> tion-strategies which are all equally appropriate for this purpose.
> Heap-allocation is a different topic.
 
Look, it's ok that you don't know this, and you have no idea how it works.
Nobody's perfect. Don't let it upset you.
Sam <sam@email-scan.com>: Nov 15 11:12AM -0500

Bonita Montero writes:
 
>> whenever it believes that there can be a good reason why the developer
>> might need to know which choice an implementation has made.
 
> Ar there only idiots discussing here?
 
No, but you're doing your best to tip the scales.
 
> It doesn't matter if the standard
> doesn't say how the exception-objects might be allocated. It is never-
> theless an interesting question.
 
Here's your merit badge for asking interesting questions. Wear it proudly,
you earned it. Congratulations.
 
> (which reaches a lot more developers) from someone else some time ago
> yielded no satisfying annswer. So no one seems to be concerned about
> that.
 
Right. To any rational person, that would've been a big honking clue. What
about you?
Bonita Montero <Bonita.Montero@gmail.com>: Nov 15 06:45PM +0100

>> questions they can't answer.
 
> That suggests that your ability to guess at people's unstated motivations
> is not very reliable.
 
It is reliable since this can be derived from the kind of answer.
James Kuyper <jameskuyper@alumni.caltech.edu>: Nov 15 10:00AM -0500

On 11/15/19 6:34 AM, Sam wrote:
 
>>> It is precise answer to question asked. ...
 
>> "unspecified" isn't precise.
 
> It is precise enough for every C++ developer.
 
Agreed. Implementation-defined behavior is
"unspecified behavior where each implementation documents how the choice
is made" (3.4.1).
 
The committee specifies that something is implementation-defined
whenever it believes that there can be a good reason why the developer
might need to know which choice an implementation has made.
It follows that if the behavior is unspecified, and NOT
implementation-defined, the committee believes that developers will
generally not need to know which choice was made.
That's relevant here, because the way memory is allocated for exception
objects is a prime example of that second category. Since most
developers don't need to know, most developers don't know. Just a few
experts who know a lot more about how a given implementation works than
most people, will have the answers to Bonita's question, and most of
those people are much easier to find in a forum specific to the
implementation that they're experts on, than they would be in this
newsgroup.
Wisdom90 <d@d.d>: Nov 16 10:38AM -0500

On 11/16/2019 1:36 AM, Bonita Montero wrote:
>         assert(scn[0] <= scn[1]);
>     return EXIT_SUCCESS;
> }
 
 
 
 
Look at this , i think it will help you to speed up Parallel Quicksort:
 
Parallel partition phase for quick sort
 
https://blogs.msdn.microsoft.com/dhuba/2012/03/04/parallel-partition-phase-for-quick-sort/
 
 
 
Thank you,
Amine Moulay Ramdane.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 16 05:55PM +0100

> I want to make Delphi much more powerful by inventing scalable
> algorithms and implementing them in Delphi..
 
That's like making a steam locomotive more powerful _today_.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 16 11:31AM +0100

>         unsigned rightThreads = nThreads / 2,
>                  leftThreads  = nThreads - rightThreads;
 
With this dyanamic partitioning the throughput on my random
-numers raises by 67%. Unbelievable for such a simple change.
 
unsigned rightThreads = (unsigned)(nThreads * (right - p +
1.0) / (right - left + 1)),
leftThreads = nThreads - rightThreads;
Bonita Montero <Bonita.Montero@gmail.com>: Nov 16 05:32PM +0100

> I have made some of my Delphi projects work with C++, here is one of them:
 
No one has the weird idea to mix Delphi and C++. And often there is code
with generic classes which can't be mixed. Accept it or not: Delphi is
and will never be relevant in the world of sw-development. At the time
when Delphi hit the market, the train for Pascal-derivatives had already
come to an end.
Wisdom90 <d@d.d>: Nov 16 11:24AM -0500

On 11/16/2019 11:02 AM, Bonita Montero wrote:
> There's almost no one that uses Pascal.
> Pascal has died in the 90s.
> So there won't be almost no one that uses your code.
 
 
 
Hello,
 
 
My Delphi projects work with C++Builder..
 
 
Here is C++Builder: https://www.embarcadero.com/products/cbuilder
 
 
Here is how to use my Delphi projects with C++Builder:
 
Mixing Delphi and C++
 
https://community.idera.com/developer-tools/b/blog/posts/mixing-delphi-and-c
 
 
 
Thank you,
Amine Moulay Ramdane.
Wisdom90 <d@d.d>: Nov 16 11:24AM -0500

On 11/16/2019 11:08 AM, Wisdom90 wrote:
 
> https://glooscapsoftware.blogspot.com/2017/05/software-made-with-delphi-how-do-you.html
 
> Thank you,
> Amine Moulay Ramdane.
 
Hello,
 
 
My Delphi projects work with C++Builder..
 
 
Here is C++Builder: https://www.embarcadero.com/products/cbuilder
 
 
Here is how to use my Delphi projects with C++Builder:
 
Mixing Delphi and C++
 
https://community.idera.com/developer-tools/b/blog/posts/mixing-delphi-and-c
 
 
 
Thank you,
Amine Moulay Ramdane.
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 12:51AM +0100

#include <iostream>
 
template< char c, class Type >
struct Mut_t_;
 
template< class Type >
struct Mut_t_<'*', Type>{ using T = Type*; };
 
template< char c, class Type >
using Mut_ = typename Mut_t_<c, Type>::T;
 
#define $( c, ... ) Mut_<#c [0], __VA_ARGS__>
 
void foo( const $(*, const char) s )
{
std::cout << s << '\n';
}
 
auto main()
-> int
{
foo( "Baluba!" );
}
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: