- "Richard Stallman Announces C Reference" - 4 Updates
- Using local variables in C callbacks - 7 Updates
| Juha Nieminen <nospam@thanks.invalid>: Sep 13 06:47AM > code is going to do and/or where the program counter is going to go. There > is nothing to fall back on to tidy up any fuckups and no C++ runtime to hold > your hand. You seem to think that the Linux kernel has some kind of extraordinarily strict requirement in terms of what the code is doing, at the lowest level, so that it's always absolutely clear exactly what the CPU is doing at any given moment, what the values of registers (especially the instruction pointer) are, and so on. You seem to be painting kernel code as something that it actually isn't. There's nothing particularly special about kernel code. The vast majority of it is just pretty normal C code with no special requirements. You don't need to know "where the program counter is going to go". Why would you? For what reason? If an interrupt happens, then registers are stored as normal and then restored. (The only peculiar limitation in kernel code is that you can't use the standard C library for anything, because most of it cannot work at the kernel level, especially at boot time before any partitions have been mounted and thus no dynamically loadable libraries can be used. However, this just limits your use of the standard library, for practical reasons rather than "you need to always know where the program counter is going to go". The kernel offers alternatives for most of the standard library utilities that are useful in kernel code.) |
| Muttley@dastardlyhq.com: Sep 13 01:27PM On Mon, 12 Sep 2022 20:32:21 +0200 >> of allocations. >Just don't see how we know that int y = f(x); doesn't call other >functions that allocate structs on the heap? Structs that contain It may well do, but you can at least look at them to see how and kernel authors are extremely careful about how they allocate dynamic memory. Meanwhile who knows if std::string s = "hello" will allocate on the heap or if it'll use its small reerved amount of stack. |
| Muttley@dastardlyhq.com: Sep 13 01:29PM On Tue, 13 Sep 2022 06:47:53 -0000 (UTC) >standard C library for anything, because most of it cannot work at the >kernel level, especially at boot time before any partitions have been >mounted and thus no dynamically loadable libraries can be used. However, Oh dear, and you were doing so well. Heard of libc.a? |
| Andreas Kempe <kempe@lysator.liu.se>: Sep 13 10:33PM > are extremely careful about how they allocate dynamic memory. Meanwhile > who knows if std::string s = "hello" will allocate on the heap or if it'll > use its small reerved amount of stack. In my view, this is not a language problem as much as a standard library implementation problem. As have been brought up earlier, you don't use the normal user space libc in the kernel for C code, but have parts of the standard library implemented in a way to make it fit the kernel. To seriously bring C++ into the kernel world, one would have to do the same. That is, pick functions from the standard library that make sense in the kernel and implement them to work there. One such thing could of course be an std::string without hidden heap allocations. I, and doubtlessly many others, have long toyed with the idea that kernel programming, Linux or *BSD is what I'm familiar with, could be made simpler with a language that supports object oriented programming instead of using C structs with function pointers. The possibility of doing RAII would also be nice. Whether that language should be C++ is another question and I don't have a good answer. |
| Tony Oliver <guinness.tony@gmail.com>: Sep 12 05:05PM -0700 On Sunday, 11 September 2022 at 16:57:39 UTC+1, Bonita Montero wrote: ---< snip >--- > I program like that every day That's not the boast you thought it was. |
| Bonita Montero <Bonita.Montero@gmail.com>: Sep 13 07:18AM +0200 Am 13.09.2022 um 02:05 schrieb Tony Oliver: > ---< snip >--- >> I program like that every day > That's not the boast you thought it was. That's not boast at all. |
| Juha Nieminen <nospam@thanks.invalid>: Sep 13 06:52AM > You're a person that constantly feels uncertain and you need > some rituals to feel certain; people that don't adhere to your > rituals make you feel ucertain again. The programmer is the poorest person to evaluate the readability of his own code. He needs the perspective of another programmer to know how readable and understandable his code actually is. I also find funny you talking about "rituals". What else is always writing the "using namespace std;" boilerplate than pretty much effectively a ritual? |
| Bonita Montero <Bonita.Montero@gmail.com>: Sep 13 12:09PM +0200 Am 13.09.2022 um 08:52 schrieb Juha Nieminen: > The programmer is the poorest person to evaluate the readability of his > own code. He needs the perspective of another programmer to know how > readable and understandable his code actually is. Maybe, but I won't assess my code by idiots. > I also find funny you talking about "rituals". What else is always > writing the "using namespace std;" boilerplate than pretty much > effectively a ritual? If you're overburdened by such simple things - better don't program at all. |
| Juha Nieminen <nospam@thanks.invalid>: Sep 13 12:57PM >> own code. He needs the perspective of another programmer to know how >> readable and understandable his code actually is. > Maybe, but I won't assess my code by idiots. Isn't it funny that I don't need to resort to any sort of insult or childish namecalling, and I still trigger you? >> effectively a ritual? > If you're overburdened by such simple > things - better don't program at all. Says the person who seems so badly overburdened by having to write some prefixes that you avoid them like the plague and always write that "using" magic spell at the beginning of every single source file like your life depended on it, and ferociously attack anybody who questions your decision. One has to question why you are so adamant and aggressively defensive about it. |
| Bonita Montero <Bonita.Montero@gmail.com>: Sep 13 03:57PM +0200 Am 13.09.2022 um 14:57 schrieb Juha Nieminen: > "using" magic spell at the beginning of every single source file like > your life depended on it, and ferociously attack anybody who questions > your decision. I do that not because I'm overburdened but just because that's my style. I don't know where the problem is for you here. This forum is a leisure activity and not a community project. Everyone can live out their prferences. The fact that you think you have to proselytize for your style seems seriously mentally disturbed. You probably need psychotherapy. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Sep 13 12:48PM -0700 On 9/12/2022 11:52 PM, Juha Nieminen wrote: >> rituals make you feel ucertain again. > The programmer is the poorest person to evaluate the readability of his > own code. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do you mind if I quote that? I will give proper attributions of course, Juha. :^) |
| 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:
Post a Comment