| General > General Technical Chat |
| How many people code in C these days, and if so, why? |
| << < (16/99) > >> |
| nctnico:
--- Quote from: Wolfgang on May 06, 2020, 07:11:37 pm ---Its generally not smart to mingle OO and real time. Reason: OO resource management is somehow unpredictable and might add uncalculatable runtime when you cant afford it. No usable OS kernel I know is written in an OO language. Not even Windows :) --- End quote --- But that is more due to religion than due to common sense. Also a lot of OSses stem from before C++ was commonly used. If you look at the Linux kernel for example I'm 100% sure it will run faster when it is written in C++ because the compiler can optimise much more compared to regular C. For example: A regular C compiler can't inline functions which are pointed to by a function pointer. In C++ the compiler can do that if that function pointer never changes. |
| Wolfgang:
the const attribute is available in plain C too nowadays, IIRC. Its just a matter of safety; In C you can almost guess what assembly will come out of it. In OO code with overloaded functions, multiple inheritance, ... its hard to optimize, not very safe and transparent. I would not trust that in mission critical cores, IMHO. |
| Picuino:
I think the ideal is to combine the best of each world. C to make quick and efficient code libraries combined with a scripting language like Python, Lua or TCL to develop the application at a high level. Many software packages do so today. |
| nctnico:
--- Quote from: Wolfgang on May 06, 2020, 07:32:31 pm ---the const attribute is available in plain C too nowadays, IIRC. Its just a matter of safety; In C you can almost guess what assembly will come out of it. In OO code with overloaded functions, multiple inheritance, ... its hard to optimize, not very safe and transparent. I would not trust that in mission critical cores, IMHO. --- End quote --- It is only hard to optimise if an object is linked in runtime (runtime polymorfism for exampe) but other than that relations are 100% known during compile time. |
| bd139:
--- Quote from: Picuino on May 06, 2020, 07:37:49 pm ---I think the ideal is to combine the best of each world. C to make quick and efficient code libraries combined with a scripting language like Python, Lua or TCL to develop the application at a high level. Many software packages do so today. --- End quote --- Spot on. Exactly that. :-+ Also glad to see TCL mentioned in 2020 :-+ |
| Navigation |
| Message Index |
| Next page |
| Previous page |