Thursday, November 30, 2017

Digest for comp.lang.c++@googlegroups.com - 16 updates in 4 topics

Bob <user@foobar.com.invalid>: Nov 30 02:12AM

Not a homework problem, too dumb for school.
https://forum.level1techs.com/t/c-openmp/121868
"Öö Tiib" <ootiib@hot.ee>: Nov 29 11:00PM -0800

On Thursday, 30 November 2017 04:12:48 UTC+2, Bob wrote:
> Not a homework problem, too dumb for school.
> https://forum.level1techs.com/t/c-openmp/121868
 
It hangs or crashes or what means "dies" and where?
Can't you run it in debugger?
"Necron_99" <user@foobar.com.invalid>: Nov 30 03:06PM

=?UTF-8?B?w5bDtiBUaWli?= <ootiib@hot.ee> wrote in news:1a39d558-c400-4cad-bdfc-
>> https://forum.level1techs.com/t/c-openmp/121868
 
> It hangs or crashes or what means "dies" and where?
> Can't you run it in debugger?
 
I've run smaller values of n in valgrind, no leaks detected. It dies during execution of the openp for
section. Anyway I'm following up on some suggestions I got over at
https://forum.level1techs.com/t/c-openmp/121868
"Öö Tiib" <ootiib@hot.ee>: Nov 30 09:24AM -0800

On Thursday, 30 November 2017 17:07:07 UTC+2, Necron_99 wrote:
> during execution of the openp for section. Anyway I'm following up
> on some suggestions I got over at
> https://forum.level1techs.com/t/c-openmp/121868
 
Still no answer what means "dies"? Programs are not alive so can't die.
Christian Gollwitzer <auriocus@gmx.de>: Nov 30 11:59PM +0100

Am 30.11.2017 um 03:12 schrieb Bob:
> Not a homework problem, too dumb for school.
> https://forum.level1techs.com/t/c-openmp/121868
 
You manipulate "x" (is this a global std::vector?) inside of
randomSample(). This is called in your openMP-loop and will therefore
execute in parallel. This can't work. You need to make sure that the
same object is not touched simultaneously from multiple threads. Either
protect with locks (lock_guard<>), or duplicate the vector. And even
better, remove the global. It is not sure where it is coming from, since
you don't show complete compilable code.
 
Christian
Josef Moellers <josef.moellers@invalid.invalid>: Nov 30 04:37PM +0100

I have written a small Qt program which displays a set of topics
subscribed from a mosquitto broker. At present, the program uses
libmosquitto, but I'd like to make it use libmosquittopp (it is also a
learning exercise).
The set of topics is not static, the topics are passed on the command
line, so I need a means to hand this set (forged into a QStringList) to
the on_connect() method in order to subscribe to all the topics given.
 
There is the user_data_set(void *userdata) method in the class
mosquittopp but it only passes the "userdata"-pointer to the underlying
mosquitto code. Any callback specified by
mosquitto_connect_callback_set() will then get this pointer but not the
on_connect() method!
 
Any hints?
 
Thanks,
Josef
"Öö Tiib" <ootiib@hot.ee>: Nov 30 08:32AM -0800

On Thursday, 30 November 2017 17:37:51 UTC+2, Josef Moellers wrote:
> mosquitto_connect_callback_set() will then get this pointer but not the
> on_connect() method!
 
> Any hints?
 
Very interesting. We are here on comp.lang.c++ discussing C++
language itself. With C++ it is possible to integrate anything with
anything but from your post it is not very clear what the issue is.
Is with mosquitto or with Qt or with your own C++ code?
 
To difficulties with mosquitto you perhaps get best hints from
https://groups.google.com/forum/#!forum/mqtt
 
To difficulties with Qt you get perhaps best hints at
https://forum.qt.io
 
If it is your own code that causes trouble then we can likely help
but can you give us illustrating example of the problem without
using neither Qt nor mosquitto?
Josef Moellers <josef.moellers@invalid.invalid>: Nov 30 06:56PM +0100

On 30.11.2017 17:32, Öö Tiib wrote:
> language itself. With C++ it is possible to integrate anything with
> anything but from your post it is not very clear what the issue is.
> Is with mosquitto or with Qt or with your own C++ code?
 
It is actually with the mosquitto code. I searched the list of
newsgroups my provider has and it had nothing that adressed this issue,
so I tried here. I'll go where you told me to go:
 
> To difficulties with mosquitto you perhaps get best hints from
> https://groups.google.com/forum/#!forum/mqtt
Sorry for the inconvenience,
 
Josef
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 30 06:21AM -0800

As the years go by and more and more previously commercial (and even
open source) software makes the move into abandonware, where the original
copyright and/or patent holder is no longer maintaining or developing the
software ... my view is it should move into the area of the public domain,
legally protected for any use at that point, with all restrictions on use
rights completely removed, allowing binary deconstruction, reverse
engineering, machine code extraction, essentially use for any purpose.
 
It makes no sense that abandonware should not receive a legal standing,
such that any person or company who approaches it for use is actually
protected under the law. They should have that protection. The use of
that pre-existing tool should be at their disposal when the entity who
originally held rights to it walks away.
 
--
Rick C. Hodgin
mcheung63@gmail.com: Nov 30 06:36AM -0800

FUCK OFF ASSHOLE
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 30 06:40AM -0800

> .. OFF ..
 
I love you, Mr. Cheung. I want the best for you. I want you to thrive.
I want you to have inner peace, love, and joy like you've never known.
 
I want you to be the full creation God intended for you before sin entered
in and destroyed everything.
 
I want to be your friend. I want to someone you can turn to for help,
and who I can turn to for help. I want us working together and being
like proper family members would be one to another, willing to help out
one another even to that extent.
 
I'm sorry you don't feel that way, Peter.
 
--
Rick C. Hodgin
woodbrian77@gmail.com: Nov 29 08:28PM -0800

On Tuesday, November 28, 2017 at 12:34:45 PM UTC-6, Öö Tiib wrote:
> fully qualified name of any name x of standard library is ::std::x unless explicitly described otherwise.
 
> Usage of the name std for anything can in practice still get ones work
> contract ended as deliberately confusing others and hampering team-work.
 
 
If the team uses the :: prefix, then when a new person is
ready to have some of his code reviewed, if he hasn't already
figured it out from reading the code base, he should be told
to add the :: prefix. I see it as defensive programming.
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
David Brown <david.brown@hesbynett.no>: Nov 30 08:49AM +0100

> ready to have some of his code reviewed, if he hasn't already
> figured it out from reading the code base, he should be told
> to add the :: prefix.
 
Clearly the standard used by an existing team is important - consistency
in a style is higher priority than any particular decision about style
(unless that decision is truly idiotic).
 
But Öö said that using the identifier "std" for anything other than the
standard global namespace should be a firing offence - he did not say
that using "::std" should get you fired.
 
> I see it as defensive programming.
 
No, it is ugly paranoia. It is "defensive programming" in the same way
that putting copper bands over all the trees in your garden is
"defending against lightening strikes".
 
There are some kinds of coding where that level of "make sure everything
works, no matter what other people do" is justified. You can look in
some implementation library headers and see pervasive use of identifiers
like "__x" rather than "x". This is because it is legal in C and C++ to
have "#define x int" (or whatever) before including the header - and the
header should work no matter what the user does, as long as the
standards allow it. But that sort of thing makes the code messier and
harder to follow - it comes at a price, and it is only appropriate in
very specific circumstances.
 
Similarly, the use of "::std" might be justified within the standard
headers. In normal coding, it serves only to cause confusion (by being
different from almost all other C++ programmers) and make code messier.
 
I have only looked at the C++ headers for one compiler - gcc - but they
use "std" almost exclusively. There is only one use of "::std" that I
can see, and that looks like a mistake.
"Öö Tiib" <ootiib@hot.ee>: Nov 30 12:05AM -0800

> ready to have some of his code reviewed, if he hasn't already
> figured it out from reading the code base, he should be told
> to add the :: prefix. I see it as defensive programming.
 
Yes but what it is that your "defensive programming" defends against?
 
If you defend against name "std" really misused then you defend against
mythological thing. Who had real clown in their team who really named
something as "std" in their production C++ code-base? Why? When? Where?
What problems it caused? How it was resolved? I haven't seen or heard
about that during the very decades, no urban legends nor fiction, nothing.
 
If you defend against sabotage in general then you defend against
what sometimes happens and against that there are no defenses.
If programmer wants to disrupt C++ project or turn it into hard to
debug and maintain then they can do it in countless less palpable ways.
Risk of such enemy in your ranks can not be mitigated by "defensive
programming".
 
What are the most hard and annoying debugging problems? These are
when program only rarely does something incorrect. Gives wrong
results for unknown reasons. Nothing actually neither crashes nor
hangs because of that just results are wrong. Bonus points for being
disguised as typo in reasonable-looking code and being not reproducible
with same input data. Resulting program is untrustworthy and so useless.
That is what good antagonist would implement in your software and not
other namespace named "std".
 
I would buy if you said that "::std" is beautiful for your eyes
but as "defense" it is clearly pointless erosion of colon key.
"Öö Tiib" <ootiib@hot.ee>: Nov 30 01:49AM -0800

On Thursday, 30 November 2017 09:49:29 UTC+2, David Brown wrote:
 
> But Öö said that using the identifier "std" for anything other than the
> standard global namespace should be a firing offence - he did not say
> that using "::std" should get you fired.
 
Exactly. I see "::std" pointless. I still would write it if that was coding
standard. Consistency and "because we do it that way" are strong
reasons for me. Doing something slightly pointless is fine for
consistency and unity.
 
I argue against people who say that the "::std" helps against
actual, real problem. That is disinformation. They never provide
evidence. They even NEVER compose any fiction. How that
"problem" really did sting their or someone else's fanny? How
it took weeks to cure the swollen buttocks? Nada. Nil. Nothing.
So not worth to follow.
asetofsymbols@gmail.com: Nov 30 02:55AM -0800

I find that hide(nascondere) it is the main problem C++ has
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: