Monday, September 19, 2022

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

Lynn McGuire <lynnmcguire5@gmail.com>: Sep 19 03:02PM -0500

On 9/18/2022 11:56 AM, Bonita Montero wrote:
 
> You're a very bad programmer for sure as I already have noticed.
> Not because of this, but people having such narrow-minded attitudes
> are unflexible.
 
Nope, I am stewarding 1.3 million lines of F77 and C++ code. Use of the
using command is incredibly dangerous across our incredibly large code base.
 
Lynn
Bonita Montero <Bonita.Montero@gmail.com>: Sep 19 10:12PM +0200

Am 19.09.2022 um 22:02 schrieb Lynn McGuire:
 
> Nope, I am stewarding 1.3 million lines of F77 and C++ code.  Use of the
> using command is incredibly dangerous across our incredibly large code
> base.
 
This doesn't depend on the size of the code.
As re-using symbols of std is uncommon in other namespaces and
the compiler would error for clashes anyway this isn't a deal.
Mr Flibble <flibble@reddwarf.jmc.corp>: Sep 19 09:48PM +0100

On Mon, 19 Sep 2022 22:12:21 +0200
 
> This doesn't depend on the size of the code.
> As re-using symbols of std is uncommon in other namespaces and
> the compiler would error for clashes anyway this isn't a deal.
 
There is no reason to ever use "using namespace std;" at global scope
and any benefit is outweighed by disadvantages.
 
/Flibble
Lynn McGuire <lynnmcguire5@gmail.com>: Sep 19 03:59PM -0500

On 9/19/2022 3:12 PM, Bonita Montero wrote:
 
> This doesn't depend on the size of the code.
> As re-using symbols of std is uncommon in other namespaces and
> the compiler would error for clashes anyway this isn't a deal.
 
Good luck with that thought. The compiler uses the first method that
meets the conditions. If you are lucky you might get a warning that
there is more than one method that meets the conditions. Been there,
done that with Visual C++ back in the 2000s.
 
Lynn
Juha Nieminen <nospam@thanks.invalid>: Sep 19 05:45AM

> to society. Documents like that guide are not light-hearted or
> entertaining in a workplace - they are an embarrassment. It's fine to
> post that kind of humour as a joke, but not as a requirement for real work.
 
I have seriously entertained the idea of contacting the people maintaining
the kernel website and offering to reword that page to use a more neutral
and professional language (just the exaplantory text, not the code examples
themselves).
 
However, I don't think it's worth the effort to even contact them because
I'm somewhat certain of what their answer will be. Something along the
lines of "the page is fine as it is, there's no need to change it."
And I wouldn't be surprised if there was some slight mockery in the
response. (And that's assuming I would get any response at all.)
Juha Nieminen <nospam@thanks.invalid>: Sep 19 05:51AM

> (as well as being modernised to include
> C11, now that it is the standard for the kernel).
 
Speaking of which, I find it a bit surprising that there seems to be no
official rule, directive or even recommendation on which version of C
can/should be used in kernel code. Or at least I can't find this anywhere
(I have tried).
 
The only thing I have found is some directive/rule that the kernel has
to compile with gcc 3.3, but AFAIK even that rule is old and obsolete
(and the current kernel might not compile with that version of gcc
anymore.)
Juha Nieminen <nospam@thanks.invalid>: Sep 19 06:06AM

> making timing code pretty easy to write. The bad thing is that there
> is, to my knowledge, no good open source compiler, although the basic
> Microchip C compiler is free as in free beer.
 
I suppose sdcc is *the* C compiler for 8-bit CPUs, although their webpage
states that "Microchip PIC16 and PIC18 targets are unmaintained" (which
I don't know if it means that you can't compile for them, or just that
there might be bugs or inefficiencies.)
 
Not that sdcc is an extraordinarily good compiler (it's quite bad at
optimizing for size or speed. For example it will often load the same
value from memory to a register several times for several consecutive
operations because the optimizer is unable to see that the value was
already loaded to that register and hasn't changed.)
Juha Nieminen <nospam@thanks.invalid>: Sep 19 06:11AM

> distinction, I think, whether the system is running a single statically
> linked program as its main task (either bare bones, or with an RTOS of
> some kind).
 
There are still tons of devices which use processors so small that it
wouldn't make any sense to have Linux running in them, just for them
to blink some leds and update some LCD, or act as a watchdog. Price
and power consumption (and sometimes even physical size) play important
roles here.
David Brown <david.brown@hesbynett.no>: Sep 19 10:14AM +0200

On 19/09/2022 08:11, Juha Nieminen wrote:
> to blink some leds and update some LCD, or act as a watchdog. Price
> and power consumption (and sometimes even physical size) play important
> roles here.
 
We use such microcontrollers all the time. Note that there are /many/
advantages of them - not just price, power and size. There are complete
Linux SOMs available that are smaller and cheaper (and not much more
power) than some of the microcontrollers I use, but the microcontrollers
are still the better choice by a long way.
 
In terms of counts of devices shipped, processors that are capable of
running an OS like Linux are a negligible rounding error compared to
microcontrollers.
 
(Mind you, someone managed to get Linux running on an 8-bit AVR
microcontroller...
<http://dangerousprototypes.com/blog/2012/03/29/running-linux-on-a-8bit-avr/>
)
Muttley@dastardlyhq.com: Sep 19 08:33AM

On Sun, 18 Sep 2022 12:13:51 +0200
>to society. Documents like that guide are not light-hearted or
>entertaining in a workplace - they are an embarrassment. It's fine to
>post that kind of humour as a joke, but not as a requirement for real work.
 
Like I said, you're a humourless bore, you didn't need to prove it yet again.
If you're a manager god help your team, they must dread any meetings they
have to suffer with you.
Juha Nieminen <nospam@thanks.invalid>: Sep 19 10:41AM

> Like I said, you're a humourless bore, you didn't need to prove it yet again.
> If you're a manager god help your team, they must dread any meetings they
> have to suffer with you.
 
You do understand that's not an argument against the notion that official
kernel documentation should be more professional in tone and style?
David Brown <david.brown@hesbynett.no>: Sep 19 01:48PM +0200

On 19/09/2022 12:41, Juha Nieminen wrote:
>> have to suffer with you.
 
> You do understand that's not an argument against the notion that official
> kernel documentation should be more professional in tone and style?
 
I think you are overestimating him by questioning if he understands
anything at all. And we can be very confident that even if he has
actually learned anything from the information he has been given, he
will not admit it.
Muttley@dastardlyhq.com: Sep 19 03:22PM

On Mon, 19 Sep 2022 13:48:29 +0200
>> kernel documentation should be more professional in tone and style?
 
>I think you are overestimating him by questioning if he understands
>anything at all. And we can be very confident that even if he has
 
Humourless AND arrogant.
 
>actually learned anything from the information he has been given, he
>will not admit it.
 
Why would I change my opinion? The kernel is not a company product, its OSS
and the tone can be whatever Linus wants. If you don't like it thats your
problem, not his. I'm sure the Windows documentation is very professional.
Shame about the OS.
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Sep 19 12:27PM -0700

> to compile with gcc 3.3, but AFAIK even that rule is old and obsolete
> (and the current kernel might not compile with that version of gcc
> anymore.)
 
https://www.kernel.org/doc/html/latest/process/programming-language.html
 
The kernel is written in the C programming language [c-language].
More precisely, the kernel is typically compiled with gcc [gcc]
under -std=gnu11 [gcc-c-dialect-options]: the GNU dialect of
ISO C11. clang [clang] is also supported, see docs on Building
Linux with Clang/LLVM.
 
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
Lynn McGuire <lynnmcguire5@gmail.com>: Sep 19 02:04PM -0500

My CppCon 2022 talk is online: "Can C++ be 10x simpler & safer … ?" by
Herb Sutter

https://herbsutter.com/2022/09/19/my-cppcon-2022-talk-is-online-can-c-be-10x-simpler-safer/
 
Lynn
Juha Nieminen <nospam@thanks.invalid>: Sep 19 06:15AM

> So, what do you think of the new version of "The Little Mermaid", with a
> black girl in the lead role?
 
That's not even a possible topic of discussion in pretty much any setting.
People can only show adulation and support, or be called "racists".
Not much of a discussion.
gazelle@shell.xmission.com (Kenny McCormack): Sep 19 12:44PM

In article <tg91eg$18hb$2@gioia.aioe.org>,
 
>That's not even a possible topic of discussion in pretty much any setting.
>People can only show adulation and support, or be called "racists".
>Not much of a discussion.
 
I hope you get why I posted it.
 
It is every bit as relevant as the rest of this thread.
 
--
b w r w g y b r y b
Language Lawyer <language.lawyer@gmail.com>: Sep 19 03:28AM -0700

> Section 7.4 is written with the assumption that there will be two operands being treated, but in this case there is only one. Thus a solution is to revise 7.4 so it addresses the more general scenario of converting one or more operands.
 
Or explicitly say in [expr.add] that the promotion is performed on the integer or enumeration operand, as [expr.unary.op] does (https://timsong-cpp.github.io/cppwp/n4861/expr.unary.op#7.sentence-2, https://timsong-cpp.github.io/cppwp/n4861/expr.unary.op#8.sentence-2, https://timsong-cpp.github.io/cppwp/n4861/expr.unary.op#10.sentence-2)
Muttley@dastardlyhq.com: Sep 19 08:30AM

On Sat, 17 Sep 2022 18:34:44 +0200
>> things to do on a saturday than run it in my head.
 
>Without C++20 you would have to unroll the fold expressions
>N times, in this case 10.000 times. Have fun !
 
Has c++20 just invented recursion then?
 
I've never seen anything in C++ that couldn't be done in C albeit with much
more - often messy - code. I doubt that has changed.
Bonita Montero <Bonita.Montero@gmail.com>: Sep 19 10:37AM +0200


>> Without C++20 you would have to unroll the fold expressions
>> N times, in this case 10.000 times. Have fun !
 
> Has c++20 just invented recursion then?
 
No, C++17 has added fold expressions and C++20 has added templated lambdas.
Muttley@dastardlyhq.com: Sep 19 08:54AM

On Mon, 19 Sep 2022 10:37:08 +0200
>>> N times, in this case 10.000 times. Have fun !
 
>> Has c++20 just invented recursion then?
 
>No, C++17 has added fold expressions and C++20 has added templated lambdas.
 
Useful no doubt, but yet more syntactic noise in the language. Reminds me of
the old irish joke of "If you want to get there you really don't want to
start from here".
Bonita Montero <Bonita.Montero@gmail.com>: Sep 19 11:13AM +0200


> Useful no doubt, but yet more syntactic noise in the language. Reminds me of
> the old irish joke of "If you want to get there you really don't want to
> start from here".
 
If you use functional and generic programming there's no alternative
to templated lambdas for me. If you use variadic templates there's
no alternative to fold expressions; otherwise you would have to use
this tail-recursion hacks.
C++20 has become much straighter.
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: