Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #86401
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: "Richard Stallman Announces C Reference" |
| Date | 2022-09-18 12:22 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <tg6rh0$fml9$1@dont-email.me> (permalink) |
| References | (11 earlier) <tfr0f0$2ppo$1@nyheter.lysator.liu.se> <tfrv41$2rkif$1@dont-email.me> <tfsae7$iac$1@nyheter.lysator.liu.se> <tfsmhf$2vqod$1@dont-email.me> <tg2lik$29qi$1@nyheter.lysator.liu.se> |
On 16/09/2022 22:16, Andreas Kempe wrote: > Den 2022-09-14 skrev David Brown <david.brown@hesbynett.no>: >> On 14/09/2022 12:29, Andreas Kempe wrote: >>> Den 2022-09-14 skrev David Brown <david.brown@hesbynett.no>: >>>> On 14/09/2022 00:33, Andreas Kempe wrote: >>>>> Den 2022-09-13 skrev Muttley@dastardlyhq.com <Muttley@dastardlyhq.com>: >>>>>> On Mon, 12 Sep 2022 20:32:21 +0200 >>>>>> Bo Persson <bo@bo-persson.se> wrote: >>>>>>> On 2022-09-12 at 17:58, Muttley@dastardlyhq.com wrote: >>>>>>>>> my_class f(x); >>>>>>>> >>>>>>>> And if that instance has virtual functions where will the VFT go and what >>>>>>>> allocates it? Ditto any non primitive types which may cause an implcit >>>>>>> cascade >>>>>>>> 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. >>>>>> >>>>>> >>>>> >>>>> 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. >>>> >>>> When working on an OS kernel, there are lots of things in the C standard >>>> library that you avoid, and there is no difference in regard to C++. It >>>> has a lot in common with embedded development, and that is often done in >>>> C++. With the software I write, on microcontrollers, I am quite happy >>>> to use C++, but I am careful about the features I use. Exceptions are >>>> disabled, virtual inheritance is out (virtual functions are used with >>>> caution), and there is rarely a good enough reason for anything >>>> involving dynamic memory in my code. >>>> >>> >>> What size are we talking about? In a professional setting, I've only >>> worked with embedded systems large enough to run Linux. >> >> Smaller than that - usually a /lot/ smaller. I tend to think of >> "embedded Linux systems" as primarily /Linux/ systems, rather than >> primarily /embedded/ systems. Some people prefer "resource constrained >> embedded systems" as an alternative name. >> >> Basically, I am considering systems where you have a single statically >> linked program. (You might have sometimes have an extra boot program, >> or updater, or test program - but the normal mode of operation is one >> program.) >> > > I guess the term embedded is a bit diluted these days with how > powerful SoCs have become. Yes, indeed. There have always been powerful embedded systems, with big processors running big OS's, but they used to be very much in the minority. Now you can put a Pi Zero running Linux in anything. The key 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). > > Working on projects for very small processors, I've only used C or > assembly and my main experience is using PICs. I have toyed with the > idea of using C++, but there isn't really any free C++ compilers PICs > as far as I've found. > The PICs (and by that I assume you mean the 8-bit devices, not the PIC32 chips which have MIPS cores) have always had quite limited tools - they are not well suited to C coding, never mind C++. The only 8-bit microcontroller for which C++ is a reasonable option is the AVR, for which the most common compiler is gcc. The core language is well supported, but much of the library is very limited - including language-support code for things like exceptions. > Thank you for an informative reply! > >> [...]
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
"Richard Stallman Announces C Reference" Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-09 12:49 -0500
Re: "Richard Stallman Announces C Reference" scott@slp53.sl.home (Scott Lurndal) - 2022-09-09 19:03 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-10 18:16 +0200
Re: "Richard Stallman Announces C Reference" scott@slp53.sl.home (Scott Lurndal) - 2022-09-10 17:04 +0000
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-11 08:29 +0000
Re: "Richard Stallman Announces C Reference" Manfred <noname@add.invalid> - 2022-09-24 16:24 +0200
C++ is for real, C is just a toy (Was: "Richard Stallman Announces C Reference") gazelle@shell.xmission.com (Kenny McCormack) - 2022-09-24 15:54 +0000
Re: C++ is for real, C is just a toy (Was: "Richard Stallman Announces C Reference") Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-24 18:07 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-11 08:29 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-11 11:16 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-11 09:44 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-11 13:42 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-11 15:44 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-11 17:55 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-11 16:17 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-11 18:22 +0200
Re: "Richard Stallman Announces C Reference" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-09-11 12:41 -0700
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-12 06:10 +0200
Re: "Richard Stallman Announces C Reference" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-09-12 00:27 -0700
Re: "Richard Stallman Announces C Reference" Bo Persson <bo@bo-persson.se> - 2022-09-12 09:18 +0200
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-12 09:42 +0200
Re: "Richard Stallman Announces C Reference" Bo Persson <bo@bo-persson.se> - 2022-09-12 12:05 +0200
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-12 12:12 +0200
Re: "Richard Stallman Announces C Reference" Manfred <noname@add.invalid> - 2022-09-24 16:31 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-12 15:58 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-12 18:48 +0200
Re: "Richard Stallman Announces C Reference" Bo Persson <bo@bo-persson.se> - 2022-09-12 20:32 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-13 13:27 +0000
Re: "Richard Stallman Announces C Reference" Andreas Kempe <kempe@lysator.liu.se> - 2022-09-13 22:33 +0000
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-14 06:04 +0000
Re: "Richard Stallman Announces C Reference" Andreas Kempe <kempe@lysator.liu.se> - 2022-09-14 10:38 +0000
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-14 12:21 +0000
Re: "Richard Stallman Announces C Reference" Michael S <already5chosen@yahoo.com> - 2022-09-15 12:15 -0700
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-16 06:02 +0000
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-16 10:37 +0000
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-16 11:05 +0000
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-16 13:18 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-16 16:00 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-16 15:16 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-18 12:13 +0200
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-19 05:45 +0000
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-19 08:33 +0000
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-19 10:41 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-19 13:48 +0200
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-19 15:22 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-16 13:10 +0200
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-19 05:51 +0000
Re: "Richard Stallman Announces C Reference" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-19 12:27 -0700
Re: "Richard Stallman Announces C Reference" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-09-16 11:19 -0700
Re: "Richard Stallman Announces C Reference" Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-09-16 06:56 -0700
Re: "Richard Stallman Announces C Reference" scott@slp53.sl.home (Scott Lurndal) - 2022-09-16 14:29 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-16 17:04 +0200
Re: "Richard Stallman Announces C Reference" Michael S <already5chosen@yahoo.com> - 2022-09-16 08:24 -0700
Re: "Richard Stallman Announces C Reference" Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-09-16 09:00 -0700
Re: "Richard Stallman Announces C Reference" Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2022-09-15 00:54 +0100
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-15 05:31 +0000
Re: "Richard Stallman Announces C Reference" Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2022-09-15 10:19 +0100
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-22 12:41 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-14 09:16 +0200
Re: "Richard Stallman Announces C Reference" Andreas Kempe <kempe@lysator.liu.se> - 2022-09-14 10:29 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-14 15:55 +0200
Re: "Richard Stallman Announces C Reference" Andreas Kempe <kempe@lysator.liu.se> - 2022-09-16 20:16 +0000
Re: "Richard Stallman Announces C Reference" Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-16 16:55 -0500
Re: "Richard Stallman Announces C Reference" scott@slp53.sl.home (Scott Lurndal) - 2022-09-16 22:21 +0000
Re: "Richard Stallman Announces C Reference" Andreas Kempe <kempe@lysator.liu.se> - 2022-09-17 14:52 +0000
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-19 06:06 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-18 12:34 +0200
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-18 12:22 +0200
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-19 06:11 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-19 10:14 +0200
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-14 12:12 +0000
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-14 15:58 +0200
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-13 06:47 +0000
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-13 13:29 +0000
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-14 05:56 +0000
Re: "Richard Stallman Announces C Reference" Muttley@dastardlyhq.com - 2022-09-14 09:37 +0000
boost::intrusive. Was: "Richard Stallman Announces C Reference" Michael S <already5chosen@yahoo.com> - 2022-09-11 09:51 -0700
Re: boost::intrusive. Was: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-11 18:55 +0200
Re: "Richard Stallman Announces C Reference" scott@slp53.sl.home (Scott Lurndal) - 2022-09-11 16:26 +0000
Re: "Richard Stallman Announces C Reference" Bonita Montero <Bonita.Montero@gmail.com> - 2022-09-11 18:35 +0200
Re: "Richard Stallman Announces C Reference" Opus <ifonly@youknew.org> - 2022-09-12 19:22 +0200
Re: "Richard Stallman Announces C Reference" legalize+jeeves@mail.xmission.com (Richard) - 2022-09-22 19:24 +0000
Re: "Richard Stallman Announces C Reference" Michael S <already5chosen@yahoo.com> - 2022-09-10 12:56 -0700
Re: "Richard Stallman Announces C Reference" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-10 15:53 -0700
Re: "Richard Stallman Announces C Reference" "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-09-11 07:07 +0200
Re: "Richard Stallman Announces C Reference" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-11 16:17 -0700
Re: "Richard Stallman Announces C Reference" David Brown <david.brown@hesbynett.no> - 2022-09-11 13:50 +0200
Re: "Richard Stallman Announces C Reference" Michael S <already5chosen@yahoo.com> - 2022-09-11 05:53 -0700
Re: "Richard Stallman Announces C Reference" Juha Nieminen <nospam@thanks.invalid> - 2022-09-12 05:47 +0000
Re: "Richard Stallman Announces C Reference" Manu Raju <MR@invalid.invalid> - 2022-09-11 00:01 +0100
Re: "Richard Stallman Announces C Reference" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-10 16:26 -0700
Re: "Richard Stallman Announces C Reference" legalize+jeeves@mail.xmission.com (Richard) - 2022-09-22 19:21 +0000
csiph-web