Sunday, May 17, 2020

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

Bonita Montero <Bonita.Montero@gmail.com>: May 10 05:04PM +0200

>> low. So spinning doesn't make sense.
 
> It could also be that the lock is held for a longer time, but not very
> often.
 
Then spinning succeeds only when it is begun shortly before the other
thread releases the mutex, and that's very unlikely.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 10 05:00AM -0700

On 5/10/2020 4:49 AM, Bonita Montero wrote:
>> Adaptive locks make sense. A lot of OS's use them.
 
> Tell me another OS than Windows that uses them.
 
Solaris. And there are others.
 
 
> low. So spinning doesn't make sense.
 
>> https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initializecriticalsectionandspincount
 
> That's just a stupid Microsoft-idea.
 
Why do you think that Microsoft invented adaptive mutexs? lol.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 10 01:32PM -0700

On 5/10/2020 5:55 AM, Bonita Montero wrote:
>> to such ... just *stupid* and *period*. And that for cascade of posts.
>> Yawn.
 
> I told you why. Try to argue against that.
 
LOL!
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 10 01:36PM -0700

On 5/10/2020 1:32 PM, Chris M. Thomasson wrote:
 
> An adaptive mutex is a good idea. Any kernel calls that can be avoided
> is great! Btw, you should tell the Linux guys that they made a big
> mistake. ;^)
 
Iirc, they were trying to avoid some futex calls in userspace. Funny
thing about futex... It seems that Microsoft has came up with something
kind of like them:
 
https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress
 
I have used futexs, but never WaitOnAddress.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 11 12:00AM -0700

On 5/10/2020 10:54 PM, Bonita Montero wrote:
>> You said something like that if lock is needed very frequently for
>   ^^^^^^^^^^^^^^^^^^^^^^^ ...
>> very short time then there is very low likelihood of collision.
 
Why do you assume that? Please keep in mind that the complexity of the
work performed under the protection of the lock is completely different
that how this lock is going to be actually used in a system. Okay, lets
say the critical section is short and sweet, however, the usage of the
lock can experience periods of load, this means contention, and slow
paths are in store... Well, trying to avoid the slow paths is a good thing.
 
We are talking about general purpose locks, and one cannot necessarily
predict the usage patterns. Having the ability to use an adaptive lock
can be beneficial.
 
[...]
Bonita Montero <Bonita.Montero@gmail.com>: May 10 01:49PM +0200

> Adaptive locks make sense. A lot of OS's use them.
 
Tell me another OS than Windows that uses them. I told you the reason
they don't make sense. Again: if the likehood you get hold of the lock
by spinning is high the lock is only held a very short time. If it is
held a very short time, the likehood of a collision of two threads is
low. So spinning doesn't make sense.
 
> https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initializecriticalsectionandspincount
 
That's just a stupid Microsoft-idea.
Juha Nieminen <nospam@thanks.invalid>: May 10 05:52AM

>> using value_type = T;
 
> What about in C++98?
 
typedef T value_type;
Juha Nieminen <nospam@thanks.invalid>: May 10 06:01AM

> Each to their own. unsigned long is long winded
 
So? What's your point?
 
> u_long is short and to the point and standard on unix.
 
Why deliberately restrict your code to a single environment when
with an extremely small change you can make it more portable?
It makes no sense.
 
I find it quite ironic that you want your code to be C++98 conforming
to increase support for older compilers used in older systems... but
then you don't care that your code is unix-only.
Juha Nieminen <nospam@thanks.invalid>: May 11 06:27PM


> Point out where you actually gave me some useful help and I might feel upset
> about that - its still not working on gcc despite trying various suggestions
> from here.
 
But it works here, so I don't care. Right back at you.
boltar@nowhere.co.uk: May 10 08:33AM

On Sat, 9 May 2020 21:50:47 +0200
 
>The most famous is 64 bit Windows. Pointers are 64 bit - as expected -
>but long is 32 bit. So casting a pointer to unsigned long looses half of
>the information.
 
Ok, I didn't know that. It just proves to me yet again what a joke
that operating system and its tools are.
boltar@nowhere.co.uk: May 11 08:48AM

On Sun, 10 May 2020 14:09:35 -0000 (UTC)
>> clearer?
 
>*What* is the point? I don't get it.
 
>What's with this obsession that beginners have with shorter code?
 
Do try and improve your patronisation techniques. I think the dinosaurs were
using that one.
 
>Either way, if you want people *here* to help you, you should post
>code that actually compiles. Using non-standard code is a way to
>make sure that it won't compile and people will be less helpful.
 
As I've said, it compiled on 4 different systems. If thats not enough then
too bad.
Christian Gollwitzer <auriocus@gmx.de>: May 09 09:50PM +0200

>> any C++ compiler), and it will be the correct size for pointers -
>> something that does not always apply to "unsigned long".
 
> Give somes example architectures when it wouldn't apply?
 
The most famous is 64 bit Windows. Pointers are 64 bit - as expected -
but long is 32 bit. So casting a pointer to unsigned long looses half of
the information.
 
https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models
 
Christian
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: May 11 12:45AM +0100

On 11/05/2020 00:36, Mr Flibble wrote:
 
> Reddit is shit too.
 
> Fucktards.
 
> /Flibble
 
I will resist the C++ mafiosi as they try to protect their bedded in positions built on sand! :D
 
Where's North from here?
 
/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."
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 11 01:47PM -0700

On 5/8/2020 2:18 PM, Mr Flibble wrote:
> neoGFX achieves 944 FPS:
 
> https://camo.githubusercontent.com/d32e8fabf762b33adbf4f18f447f3530b9b66fd6/687474703a2f2f6e656f6766782e6f72672f74656d702f6c6f6c2e706e673f69643d31
 
When you get some really free time, can you implement the following
shader in your system, without a throttle, and tell me the fps?
 
Fwiw, here is an example of running my experimental vector field in a
shader without having to create an array of field points. This creates
the points on the fly, in real time:
 
https://www.shadertoy.com/view/3dffDX
 
Can you see this animation on your end? It should get 60 fps...
jacobnavia <jacob@jacob.remcomp.fr>: May 10 06:58PM +0200

https://jaxenter.com/c-programming-may-2020-171598.html
 
C increased by 2.82% to 17.07%
 
C++ going down 1,97% to 6,13%
Bonita Montero <Bonita.Montero@gmail.com>: May 11 08:23AM +0200

> It would be interesting to reflect why C++ has gone down so much. ...
 
I think that is has been formerly used in places where now Java and
.NET are used. Many business-applications have been written in C++
because there wasn't any alternative in the past.
Now it is only used where systems-programming and / or performance
are required.
Ian Collins <ian-news@hotmail.com>: May 10 12:53PM +1200

On 10/05/2020 12:36, Heitber Andres Montilla Ramirez wrote:
 
> I'd like to know why and how I may solve this issue.
 
> here´s the complete code (the first is the "Vector3.h" file en the
> other the "main.cpp" file.
 
Showing where the error occurs would be helpful, but I'm guessing it's
this line
 
printVector( Vector3(1, 2, 3) * 5);
 
If so, the reason is you can't initialise a non-const reference from a
temporary object. You need to update printVector to take a const
reference parameter:
 
void printVector( const Vector3 &vec)
 
<snip code>
 
--
Ian.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: May 10 11:49PM +0100

are we human? or are we dancer?
 
--
"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."
Sam <sam@email-scan.com>: May 17 02:56PM -0400

This always looked to be the intuitive way to specialize for numeric types
only:
 
std::enable_if_t<std::numeric_limits<T>::is_specialized>
 
However, this becomes ill-formed if T is an array type, like T=char [4]
because of the default values of the non-specialized template, as specified
in [numeric_limits]:
 
static constexpr T infinity() noexcept { return T(); }
static constexpr T quiet_NaN() noexcept { return T(); }
static constexpr T signaling_NaN() noexcept { return T(); }
static constexpr T denorm_min() noexcept { return T(); }
 
I think this is a defect. The non-specialized template should either not
declare these at all, or declare but not define them.
Bonita Montero <Bonita.Montero@gmail.com>: May 17 09:48PM +0200

Sorry, but who needs numeric_limits<*> for arrays ?
Sam <sam@email-scan.com>: May 17 04:05PM -0400

Bonita Montero writes:
 
> Sorry, but who needs numeric_limits<*> for arrays ?
 
Nobody. That's the whole point. That's exactly what I meant when I wrote "to
specialize for numeric types only".
"Öö Tiib" <ootiib@hot.ee>: May 17 01:53PM -0700

On Sunday, 17 May 2020 23:05:30 UTC+3, Sam wrote:
 
> > Sorry, but who needs numeric_limits<*> for arrays ?
 
> Nobody. That's the whole point. That's exactly what I meant when I wrote "to
> specialize for numeric types only".
 
Raw arrays are and remain nuisance forever.
Decay the possibly array to pointer, since also char* is not numeric type
but can be returned.
 
#include <type_traits>
#include <iostream>
 
using evil = char[4]; // <- your possibly array
 
int main()
{
// compiles and runs:
std::cout << std::numeric_limits<std::decay_t<evil>>::is_specialized
<< '\n';
}
Bonita Montero <Bonita.Montero@gmail.com>: May 17 06:15PM +0200

> Fwiw, I remember way back about a STM that had to handle SIGSEGV's and
> perform rollbacks. Something like:
> https://www.kernel.org/doc/Documentation/powerpc/transactional_memory.txt
 
1. That's not about STM but HTM of POWER8/9.
2. I think the word signal here doesn't mean a Unix-signal but something
like a CPU-interrupt; in end-effect this could lead to a Unix-signal,
but I don't believe that this was primarily meant here.
With the HTM / TSX of the Intel-CPUs interrupts also roll back
transactions and this also incorporates signals which pass through
the kernel. So I think that's the same here with the POWER-CPUs.
Bonita Montero <Bonita.Montero@gmail.com>: May 17 06:17PM +0200

>> the program when you don't catch ^C.
 
> I'm also glad you don't write programs in non-canonical
> mode *cough*ncurses*cough*
 
I know when EINTR-handling is appropriate and when not.
You don't.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 17 01:08PM -0700

On 5/17/2020 9:15 AM, Bonita Montero wrote:
>> perform rollbacks. Something like:
>> https://www.kernel.org/doc/Documentation/powerpc/transactional_memory.txt
 
> 1. That's not about STM but HTM of POWER8/9.
 
Iirc, several STM's had to handle SIGSEGV's.
 
[...]
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: