Thursday, April 11, 2019

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

Jeff-Relf.Me @.: Apr 10 08:02PM -0700

Melzzzzz <Melzzzzz@zzzzz.com>: Apr 11 03:09AM

> I want to know how you came to that conclusion.
 
> Was it this line:
 
> PageUp ? ( --PP < BB ? PP = EE, iFolder = Cnt, rFolders = 0 : ( iFolder--, rFolders++ ) ) : PageDwn ? ( ++PP > EE ? PP = BB, rFolders = Cnt, iFolder = 0 : ( iFolder++, !--rFolders ) ) : 0 ;
 
Garbage...
 
--
press any key to continue or any other to quit...
Jeff-Relf.Me @.: Apr 10 09:47PM -0700

Jeff-Relf.Me @.: Apr 10 10:10PM -0700

SergIo <invalid@invalid.com>: Apr 11 12:51AM -0500


> Was it this line:
 
> PageUp ? ( --PP < BB ? PP = EE, iFolder = Cnt, rFolders = 0 : ( iFolder--, rFolders++ ) ) : PageDwn ? ( ++PP > EE ? PP = BB, rFolders = Cnt, iFolder = 0 : ( iFolder++, !--rFolders ) ) : 0 ;
 
> What languages have you programmed in ?
 
early ones;
CP/M DOS 1.25h, ever use PIP ?
fortran, (8 byte precision, ugh, ugly) fortran 88, pascal (the $25 one)
use linux mint now on several computers (formally windows)
have two servers in garage, one is very linux low power you can install
in a wall, the other is a full up Centos HP prolient G6 w 64Gbyte RAM, 4
xeon collecting dust-too loud if above 75F. even have raspberry pi 3
b+ is good, but you have to heat sink the processer.
Jeff-Relf.Me @.: Apr 10 11:23PM -0700

David Brown <david.brown@hesbynett.no>: Apr 11 08:47AM +0200


> Was it this line:
 
> PageUp ? ( --PP < BB ? PP = EE, iFolder = Cnt, rFolders = 0 : ( iFolder--, rFolders++ ) ) : PageDwn ? ( ++PP > EE ? PP = BB, rFolders = Cnt, iFolder = 0 : ( iFolder++, !--rFolders ) ) : 0 ;
 
> What languages have you programmed in ?
 
Hi,
 
I don't know what newsgroups this thread started in or how it fits in
those groups, but this is not a thread for comp.lang.c++. Please remove
c.l.c++ from any other followups in this thread.
 
If any of you want to discuss C++, then of course you are welcome here -
but without cross-posts to such a selection of random other groups.
Pabst Blue Ribbon <pabst@blue.ribbon>: Apr 11 11:40AM

> c.l.c++ from any other followups in this thread.
 
> If any of you want to discuss C++, then of course you are welcome here -
> but without cross-posts to such a selection of random other groups.
 
That line of code above is C++.
chrisv <chrisv@nospam.invalid>: Apr 11 07:01AM -0500

Melzzzzz wrote:
 
 
>> Was it this line:
 
>> PageUp ? ( --PP < BB ? PP = EE, iFolder = Cnt, rFolders = 0 : ( iFolder--, rFolders++ ) ) : PageDwn ? ( ++PP > EE ? PP = BB, rFolders = Cnt, iFolder = 0 : ( iFolder++, !--rFolders ) ) : 0 ;
 
> Garbage...
 
I wonder if "Steve Carroll" would agree. He claims to be "unable to
access" some things that I think should be obvious, even to
non-programmers (note that he *has* done *some* programming, in his
life). "Steve" would rather concede to being a fscking idiot, than
admit that one of his shitty pals *lied* to attack me.
 
--
"ALL non-idiots support the use of testing over compile-time warnings
to determine if the code functions correctly. You're one of the few
idiots who thinks otherwise." - Dumfsck, lying shamelessly
David Brown <david.brown@hesbynett.no>: Apr 11 02:31PM +0200

On 11/04/2019 13:40, Pabst Blue Ribbon wrote:
 
>> If any of you want to discuss C++, then of course you are welcome here -
>> but without cross-posts to such a selection of random other groups.
 
> That line of code above is C++.
 
That was not code, it was line noise that happened to be legal C++
syntax. The thread - at least the bit that has been cross-posted to
c.l.c++ - has nothing to do with C++. I can't guess about the rest of
the thread, or how it is conceivable for something to be relevant to
physics, newsreader software and OS advocacy, but this out-of-context
branch of a thread is not relevant to c.l.c++.
 
If someone wants to discuss C++ code in the style of that jumble, that's
fine - that could well be a thread in c.l.c++. But then it is not about
physics or OS advocacy or newsreaders. My objection is to the
cross-posting - a line like the one quoted does not make the thread
suitable for cross-posting here any more than the fact we are writing in
English means it should be cross-posted to alt.english.usage.
Jeff-Relf.Me @.: Apr 11 06:38AM -0700

David Brown <david.brown@hesbynett.no>: Apr 11 04:10PM +0200

> It must be hard for you ( David Brown ) to laugh
> with that stick so far up your ass.
 
Do you hear that whooshing noise? It's the sound of my point flying
/way/ over your head.
 
No one cares what you think C++ is, or if you think it is the same think
as C. If you want to write drivel instead of code, that's up to you.
No one cares if you call it C++ or C.
 
If you want to discuss C++ code, start a thread in c.l.c++. If you want
to discuss C code, start a thread in c.l.c. Either would be great -
we'd love to see the posts.
 
But /please/ don't bring unrelated threads from unrelated newsgroups
into groups that still have some semblance of topicality.
 
There are no moderators here - this is a polite request.
SergIo <invalid@invalid.com>: Apr 11 09:20AM -0500

>>> What languages have you programmed in ?
 
>> Early ones: CP/M DOS 1.25h. Ever use PIP ?
 
> No, but PDP-11, on the Terak 8510 PC, was great.
 
PDP-11s did an interface to one, they are boat ancors now!
 
 
 
>> fortran, ( 8 byte precision, ugh, ugly ) fortran 88,
 
> IBM ? did you wear a suit and tie ?
 
na, collage most took fortran,
 
remember in the 90's were IBM support still had to ware dark blue suits
 
 
>> Pascal (the $25 one)
 
> In college, Turbo Pascal/C, from Philippe Kahn ( a Paris immigrant ),
> in Silicon Valley, was fantastic.
 
that was amazing when it came out, really brought prices for SW down
 
 
> Professionally, I used ETH Zurich's Modula-2 ( Niklaus Wirth ), 1981.
> Microsoft and Apple "borrowed" a lot from those guys.
 
> What country are you from ?
 
various
 
 
>> I have two Linux servers in my garage,
 
> Collecting dust ?
 
> You aren't running any servers ?
 
running a small one, a $250 a local guy is selling, HW from china, he
rolled a version of linux into it, looks like debian,
 
the other is HP and is too loud, and has old Centos 6 on it but I saw
on youtube where you can just replace the fans with quiet ones, but you
have to take the lid off the unit for good. got it for $160 from a guy
moving his surver farm to west coast
Jeff-Relf.Me @.: Apr 11 07:23AM -0700

Jeff-Relf.Me @.: Apr 11 07:45AM -0700

Melzzzzz <Melzzzzz@zzzzz.com>: Apr 11 02:59PM

>> > PageUp ? ( --PP < BB ? PP = EE, iFolder = Cnt, rFolders = 0 : ( iFolder--, rFolders++ ) ) : PageDwn ? ( ++PP > EE ? PP = BB, rFolders = Cnt, iFolder = 0 : ( iFolder++, !--rFolders ) ) : 0 ;
 
>> Garbage...
 
> Not every hard-to-read document is garbage.
 
This one is garbage...
 
 
--
press any key to continue or any other to quit...
Sam <sam@email-scan.com>: Apr 10 07:40PM -0400

Alf P. Steinbach writes:
 
>> different execution thread. As Mr. Spock would say: "highly illogical".
 
> Thanks. I don't understand why the restriction, but given that it's there,
> what can I do? Is this where condition variables are needed?
 
Yes. A mutex, a condition variable, and a bool flag can be used to implement
a logically-equivalent locking abstraction that can be unlocked by a
different execution thread.
 
The bool flag's initial value is false.
 
Your thread-independent locking operation consists of locking the
std::mutex, and waiting on the condition variable until the bool flag is
false, then setting it to true, then unlocking the mutex.
 
Your unlock operation consists of locking the std::mutex, setting the bool
flag to false, notify_all() the condition variable, then unlocking the mutex.
 
Your code is also quite vulnerable to undefined behavior due to the lifetime
of its std::mutexes which are instantiated in automatic scope. If the
std::mutex goes out of scope and gets destroyed while some other execution
thread still attempts to screw around with it, more undefined behavior.
 
I haven't analyzed whether the shown code guarantees that all references to
the mutex are gone, before it gets destroyed. But it should not be necessary
to rely on this rather fragile dependency. It's far more reliable to use
smart pointers to dynamically-allocated objects with your mutex, condition
variable, and the bool flag, and have a queue of smart pointers. Whichever
thread ends up having the last smart pointer to the object go out of scope
will destroy it, without worrying about making sure that it's the right
thread.
Paavo Helde <myfirstname@osa.pri.ee>: Apr 11 09:50AM +0300

On 11.04.2019 1:28, Alf P. Steinbach wrote:
 
>> As far as I can tell, the shown code ends up unlocking a mutex in a
>> different execution thread. As Mr. Spock would say: "highly illogical".
 
> Thanks. I don't understand why the restriction,
 
A mutex is a very simple concept. You lock the mutex for doing some
modifications on a shared data state which must appear as a single
atomic operation to other threads.
 
If the mutex is locked and unlocked in different threads, then the
operation does not look very atomic to me any more.
Juha Nieminen <nospam@thanks.invalid>: Apr 11 10:02AM

> $use_cppx( is_empty );
 
You understand that this is a C++ newsgroup, right?
 
> auto main() -> int
> {
...
> return EXIT_FAILURE;
> }
 
All things considered, I think that's actually quite fitting.
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 11 12:40PM +0100

On Thu, 11 Apr 2019 09:50:11 +0300
> atomic operation to other threads.
 
> If the mutex is locked and unlocked in different threads, then the
> operation does not look very atomic to me any more.
 
Semaphores with a maximum count of 1 can be used to provide mutual
exclusion and synchronization, and so to that extent provide atomicity
without having the ownership requirements of the (lighter overhead)
mutex. These may be what Alf wants, but I haven't examined his code in
detail. C++ does not have semaphores built in but they can be
synthesized with a condition variable, mutex and flag. (However, both
windows and POSIX have native semaphore objects.)
 
As you and others have said, in C++ mutexes have ownerhip. Only the
thread which currently holds the lock may unlock.
Paavo Helde <myfirstname@osa.pri.ee>: Apr 11 03:13PM +0300

On 11.04.2019 14:40, Chris Vine wrote:
> detail. C++ does not have semaphores built in but they can be
> synthesized with a condition variable, mutex and flag. (However, both
> windows and POSIX have native semaphore objects.)
 
C++ does not have semaphors because there is no need for them in
multithreaded programming, one can synhronize access to any shared data
state easily with a mutex and condvar.
 
When using a semaphor the automatically shared data state would be just
a single flag or a single counter, and then one would need to use more
complicated logic and more error-prone code for sharing the rest of the
data.
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 11 01:57PM +0100

On Thu, 11 Apr 2019 15:13:05 +0300
> a single flag or a single counter, and then one would need to use more
> complicated logic and more error-prone code for sharing the rest of the
> data.
 
I am not sure I understand you. If using a semaphore, the shared state
to which the semaphore is a gateway could be anything, depending on what
the user is trying to implement.
 
Perhaps you meant "if implementing a semaphore". If so, yes that is
what I wrote ("... they can be synthesized with a condition variable,
mutex and flag").
 
The main differences between a binary semaphore and a mutex is that a
semaphore can be "unlocked" by any thread and is more heavy weight to
implement. Non-binary semaphores are something else, where mutual
exclusion is not the main objective.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Apr 10 09:03PM -0700

> (my reputation becoming -1), and scolded for not just using an
> array. I then asked on comp.lang.c++ and comp.lang.c++.moderated,
> and it was answered by Bo Persson.
 
An unfortunate aspect of stackoverflow is its catering to a
culture of a continual popularity contest. I don't participate
on stackoverflow, and experiences like this one are part of the
reason why.
Melzzzzz <Melzzzzz@zzzzz.com>: Apr 11 04:07AM

> culture of a continual popularity contest. I don't participate
> on stackoverflow, and experiences like this one are part of the
> reason why.
I don't like stackoverflow at all...
 
--
press any key to continue or any other to quit...
Tim Rentsch <tr.17687@z991.linuxsc.com>: Apr 10 08:52PM -0700

"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> writes:
 
[...]
 
> I'm sorry, I'm getting old, and today had my third kidney stone
> trying to take me on. [...]
 
I am truly sorry to hear you are going through this. I will
hold off on responses in this thread for at least a few days
to give that some time to resolve. I hope you feel better
soon.
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: