Saturday, September 25, 2021

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

Branimir Maksimovic <branimir.maksimovic@gmail.com>: Sep 25 12:55AM

I don't care about such efficency, as then I would use mine natural
language, assembler.
 
--
7-77-777
\|/
---
/|\
 
--
Evil Sinner!
HorseyWorsey@the_stables.com: Sep 25 09:27AM

On Fri, 24 Sep 2021 17:25:24 +0100
> println a, b, c, d, e, f, g, h
 
>And still totally unprofessional, of course. (Maybe a professional
>wouldn't be able to claim so many hours' pay if the language was too easy!)
 
If someone needs a nice easy scripting language they'll use Python. And they
do.
 
>> Got it.
 
>Would understanding it make me happier about typing out all that <<
>nonsense above?
 
It might help.
 
 
>Have a look at the English written in these posts; what's the common
>separator between words? Yep, it's a single space. Handy for stopping
>alphanumeric entities from running into each other.
 
So? Even your sentence above contains "," "?" and " " so your reasoning
fails immediately.
 
 
> 12345678910
 
>instead of:
 
> 1 2 3 4 5 6 7 8 9 10
 
You seem to be fixated on simple output spacing. Its really not a Big Deal
for most people. How hard is printf("%d %d %d %d\n".... to write?
 
>> or maybe a tab or comma? C++ is a professional language, its not BASIC for
>> kiddies to output simple tabular results.
 
>So 'professional' equals 'unnecessarily complicated and unintuitive'?
 
No, it equals syntax able to do complex tasks easily. BASIC makes it easy to
print stuff out but I wouldn't use it to write Fintech software in!
 
> > What if someone wants 2 spaces as a seperator
> > or maybe a tab or comma?
 
>You make the most common, most useful and convenient requirement the
 
Where did you get the idea its the most common? I'm afraid thats BS. We're
talking program output, not human writing.
 
>In programming languages it is very commonly used to separate the
>elements of a list. So why not the list of expressions in a print
>statement (or whatever std::cout << is classed as).
 
face <- palm. Honestly, why don't you go play in comp.lang.basic
Bart <bc@freeuk.com>: Sep 25 11:07AM +0100

>> wouldn't be able to claim so many hours' pay if the language was too easy!)
 
> If someone needs a nice easy scripting language they'll use Python. And they
> do.
 
I write both kinds of languages, systems ones and scripting ones. Both
have the same easy print facilities. Except the scripting one can print
more complex objects too.
 
 
 
>> So 'professional' equals 'unnecessarily complicated and unintuitive'?
 
> No, it equals syntax able to do complex tasks easily. BASIC makes it easy to
> print stuff out but I wouldn't use it to write Fintech software in!
 
ANY language can make it easier to print stuff out!
 
Believe me, it's of the simplest parts of implementing a language. And
it's what needs to be done early as it plays a part in testing
everything else.
 
But some languages are pig-headed enough to make it difficult and to
keep it that way in the mistaken belief that making things too easy is
in some way 'unprofessional', and something to be look down upon.
 
So, make a rod for your own back, then.
 
>> You make the most common, most useful and convenient requirement the
 
> Where did you get the idea its the most common? I'm afraid thats BS. We're
> talking program output, not human writing.
 
Program output as text? The intention is usually to keep it human
readable. Each machine readable text will need separators.
 
(Except in the specific case of generating fixed field database files,
but those are unlikely to use hard-coded lists of print items, which is
the print feature we're talking about.)
 
At least 90% of the print statements I write (not 90% of the ones in a
finished program) are temporary ones to do with debugging.
 
 
>> elements of a list. So why not the list of expressions in a print
>> statement (or whatever std::cout << is classed as).
 
> face <- palm. Honestly, why don't you go play in comp.lang.basic
 
/I/ should do the face-palm, given your completely irrational insistence
that:
 
A << " " << B
 
is miles better than:
 
A, " ", B
 
/and/ better than simply:
 
A, B
HorseyWorsey@the_stables.com: Sep 25 10:14AM

On Sat, 25 Sep 2021 11:07:16 +0100
>> talking program output, not human writing.
 
>Program output as text? The intention is usually to keep it human
>readable. Each machine readable text will need separators.
 
And just how many C++ programs these days do you think return their output
to the console assuming human readable output is even their raison d'etre?
C++ is usually used for huge backend systems that run in the background and
any readable output will probably be formatted data written to a log that
won't be simply words seperated by a space.
 
 
> A << " " << B
 
>is miles better than:
 
> A, " ", B
 
Where did I say that? Comma is already overloaded in C/C++, it doesn't need
yet another meaning.
 
>/and/ better than simply:
 
> A, B
 
Because the use case of that for C++ is virtually non existent except in
debugging.
Bart <bc@freeuk.com>: Sep 25 11:53AM +0100

> C++ is usually used for huge backend systems that run in the background and
> any readable output will probably be formatted data written to a log that
> won't be simply words seperated by a space.
 
According to Wikipedia, C++ is a general purpose language.
 
My own applications were mostly GUI ones, with no attached console, and
the languages used still had Print.
 
Print is used also to send output to files. And could be used to display
text within a GUI window.
 
 
 
 
 
>> A, " ", B
 
> Where did I say that? Comma is already overloaded in C/C++, it doesn't need
> yet another meaning.
 
But, what on earth does that mean? Overloaded for what purpose? Last
time I looked, comma was still used to separate the arguments of a function.
 
Are you hung up on the fact that because "<<" is an operator (a very
strange one), then any replacement for that whole god-forsaken std::cout
scheme must be implemented as some kind of operator too?
 
Forget about the operator idea, it's just a list!
 
(I was going to post examples of << code, with versions that use commas
to show much easier on the eye it would be.
 
But then I accidentally caught glimpses of full-on C++ code, and
realised trying to fix this small corner of the language is completely
futile. The whole thing is just irretrievably broken.)
 
 
 
>> A, B
 
> Because the use case of that for C++ is virtually non existent except in
> debugging.
 
So quite an important use-case.
HorseyWorsey@the_stables.com: Sep 25 11:23AM

On Sat, 25 Sep 2021 11:53:39 +0100
>> any readable output will probably be formatted data written to a log that
>> won't be simply words seperated by a space.
 
>According to Wikipedia, C++ is a general purpose language.
 
Most languages are technically general purpose but most of them also
specialise in certain areas. C/C++ is mainly used in large applications,
systems and low level programming and places where speed matters. They're
not generally used to write quick and dirty console apps though you can use
them for that.
 
>> yet another meaning.
 
>But, what on earth does that mean? Overloaded for what purpose? Last
>time I looked, comma was still used to separate the arguments of a function.
 
Arguments of a function, variable definitions, class initialisers and also
to seperate function calls and assignments (though not built-in keywords for
some reason) instead of using curly brackets which not many people know eg:
 
while(i < 10) printf("i = %d\n",i),++i,puts("---");
 
>Are you hung up on the fact that because "<<" is an operator (a very
>strange one), then any replacement for that whole god-forsaken std::cout
>scheme must be implemented as some kind of operator too?
 
No. Personally I think overloading << was a stupid idea, strstroup should have
invented a turbo charged version of printf() instead like your %? instead with
a formatter that called a default class method to output itself.
 
>> Because the use case of that for C++ is virtually non existent except in
>> debugging.
 
>So quite an important use-case.
 
Only if you still using print statements to debug instead of using a debugger.
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Sep 25 12:34PM

> On Fri, 24 Sep 2021 17:25:24 +0100
 
> If someone needs a nice easy scripting language they'll use Python. And they
> do.
 
OK. Agreed. But what about ONES that think using SCRIPTING LANGUAGE,
is Bellow HONOR?
 
 
--
7-77-777
Evil Sinner!
Paavo Helde <myfirstname@osa.pri.ee>: Sep 25 03:37PM +0300

>> wouldn't be able to claim so many hours' pay if the language was too easy!)
 
> If someone needs a nice easy scripting language they'll use Python. And they
> do.
 
In Python they apparently thought printing was too simple, so in Python
3 they now require parens:
 
Python2: print 1, 2, 3
 
Python3: print(1, 2, 3)
 
BTW, in C++ one can easily define python3 style print:
 
#include <iostream>
 
inline void print() {
std::cout << "\n";
}
 
template<typename T, typename... Args>
void print(T x, Args... args) {
std::cout << x << ' ';
print(args...);
}
 
int main() {
print(1, 2, 3);
}
 
Note to Bart: the ellipses above are actual C++11 syntax, not some
pseudocode. This is a running demo program. In your own C++ code just
put these print() definitions in sme common header file, and you can use
python3 style print syntax for all built-in and other types which
support stream<<.
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Sep 25 12:57AM

And fibbers are what ? ;P
much of muchness :P
 
--
7-77-777
\|/
---
/|\
 
 
--
Evil Sinner!
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Sep 25 12:58AM

State machines are spagetty if not OO. Think about it.
 
--
7-77-777
\|/
---
/|\
 
 
--
Evil Sinner!
HorseyWorsey@the_stables.com: Sep 25 09:19AM

On Fri, 24 Sep 2021 18:17:02 +0200
 
>> That is a matter of opinion.
 
>That's not a matter of opinion. If you've managed to write a complex
>sate-machine you honor the convenience and readability of coroutines.
 
No sane person would use coroutines instead of a nice clear state machine.
How the fuck are you supposed to debug a coredump from something that uses
coroutines? You have absolutely no idea what state its in until you step
through to the call itself or feel like reading a stack dump! With a state
machine you just dump the state variable(s). Even the cppreference example
code for coroutines is an alphabet soup whereas normally their examples are
pretty clear.
 
This garbage paradigm should never have been included in C++ but it would seem
MS have the committee in its pocket.
HorseyWorsey@the_stables.com: Sep 25 09:20AM

On Fri, 24 Sep 2021 18:19:16 +0200
 
>State-machines are _always_ spahgetti-code (while( !end )
>switch( state ) { ... }), even when you write them conventionally.
>But coroutines are _much_ more readable and maintainable.
 
LMFAO!!!!!!
HorseyWorsey@the_stables.com: Sep 25 09:28AM

On Fri, 24 Sep 2021 19:21:10 -0400
 
>And I never said they are. They are not a simulation of multithreading.
>They're a failed simulation of multithreading, on a platform with a rather
>bad native implementation of multiple execution threads.
 
And a diabolical implementation of process spawning.
Bonita Montero <Bonita.Montero@gmail.com>: Sep 25 12:00PM +0200


>> That's not a matter of opinion. If you've managed to write a complex
>> sate-machine you honor the convenience and readability of coroutines.
 
> No sane person would use coroutines instead of a nice clear state machine.
 
State-machines are never clear ! You've to write a
while( state != END )
switch( state )
{
case STATE_A:
...
break;
case STATE_B:
...
break;
case STATE_C:
...
break;
}
-loop and that's _much_ less readable.
 
> How the fuck are you supposed to debug a coredump from something that uses
> coroutines? ...
 
The coroutine-frame is a block of memory of the promise.
It should be debuggable.
HorseyWorsey@the_stables.com: Sep 25 10:09AM

On Sat, 25 Sep 2021 12:00:10 +0200
> break;
> }
>-loop and that's _much_ less readable.
 
I do hope you're joking.
 
>> coroutines? ...
 
>The coroutine-frame is a block of memory of the promise.
>It should be debuggable.
 
Oh please, don't make me laugh.
Bonita Montero <Bonita.Montero@gmail.com>: Sep 25 12:18PM +0200

>> break;
>> }
>> -loop and that's _much_ less readable.
 
With C++-coroutines you have the control-flow of a normal func-
tion between the states. That's much more readable than the above
spaghetti-code. That's while fibers have been invented, but their
overhead is much larger and they're not integrated in the langauage
and thereby not so convenient.
HorseyWorsey@the_stables.com: Sep 25 10:39AM

On Sat, 25 Sep 2021 12:18:09 +0200
 
>With C++-coroutines you have the control-flow of a normal func-
>tion between the states. That's much more readable than the above
>spaghetti-code.
 
Bollocks. Coroutines are the equivalent of a load of hidden static function
variables that will be very difficult to interrogate during debugging. But
then you seem to think the sun shines out of Microsofts backside and everything
they come up with is amazing.
Bonita Montero <Bonita.Montero@gmail.com>: Sep 25 12:42PM +0200

>> spaghetti-code.
 
> Bollocks. Coroutines are the equivalent of a load of hidden static function
> variables that will be very difficult to interrogate during debugging.
 
If you write state-machines on your own the state isn't kept on the
stack as well.
HorseyWorsey@the_stables.com: Sep 25 10:44AM

On Sat, 25 Sep 2021 12:42:10 +0200
>> variables that will be very difficult to interrogate during debugging.
 
>If you write state-machines on your own the state isn't kept on the
>stack as well.
 
It doesn't matter where the state variable(s) are kept, the point is they're
easily accessable and modifiable in a debugger.
Bonita Montero <Bonita.Montero@gmail.com>: Sep 25 01:14PM +0200

>> stack as well.
 
> It doesn't matter where the state variable(s) are kept, the point is they're
> easily accessable and modifiable in a debugger.
 
That's part of your promise and can be inspected with a C++20-capable
debugger.
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Sep 25 12:32PM

> pretty clear.
 
> This garbage paradigm should never have been included in C++ but it would seem
> MS have the committee in its pocket.
 
Coroutines are nice for ones that debug in different ways.
Don't take tool because it is not appropropriate TO YOU.
it's selfish...
 
--
7-77-777
Evil Sinner!
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Sep 24 06:48PM -0700

On 9/23/2021 11:29 AM, Bonita Montero wrote:
> while( !SetEvent( (HANDLE)m_xhEvtVisit ) );
 
Humm....
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Sep 24 06:56PM -0700

On 9/24/2021 6:48 PM, Chris M. Thomasson wrote:
> On 9/23/2021 11:29 AM, Bonita Montero wrote:
>> while( !SetEvent( (HANDLE)m_xhEvtVisit ) );
 
> Humm....
 
For some damn reason, this reminds me of some broken condvar impls that
used the good ol' PulseEvent:
 
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-pulseevent
 
A quote: "This function is unreliable and should not be used. It exists
mainly for backward compatibility. For more information, see Remarks."
Bonita Montero <Bonita.Montero@gmail.com>: Sep 25 07:24AM +0200

Am 25.09.2021 um 03:56 schrieb Chris M. Thomasson:
 
> https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-pulseevent
 
> A quote: "This function is unreliable and should not be used. It exists
> mainly for backward compatibility. For more information, see Remarks."
 
What I do is reliable.
Branimir Maksimovic <branimir.maksimovic@gmail.com>: Sep 25 12:28PM


>> A quote: "This function is unreliable and should not be used. It exists
>> mainly for backward compatibility. For more information, see Remarks."
 
> What I do is reliable.
 
This is because you SAY SO?
 
--
7-77-777
Evil Sinner!
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: