|
I had no idea you could declare auto as a return value in some cases. I've only recently taken to using lambdas in C++ so that's probably part of it. I spent a long time away from C++ and am still catching up with C++ standards. So much has changed.
Real programmers use butterflies
|
|
|
|
|
I think the reason many embedded programmers prefer C to C++ lies in simplicity. If they are programming in C, they don't have to keep in mind nearly as many of the implications of how they are writing their code. It's an example of WYSIWYG. C++ provides far too many mechanisms like inheritance and overloading that impact performance and memory usage.
There's also a certain inertia in the embedded software industry. I remember when C was viewed with skepticism, while it is now a mainstay. It will take a significant number of C++ adepts moving into embedded programming before the language becomes significant. It will also need for some members of the C community to leave. People like Linus Torvalds, who makes blanket statements about defects in C++ as a language that are inherent in his mono-focus on the Linux kernel.
Software Zen: delete this;
|
|
|
|
|
I use C heavily, because it's easier to write cross-platform, cross-compiler code.
In particular, the ABI doesn't change between different (minor!) versions of the compiler.
For performance, C tends to be simpler code for sharp new algorithms.
That's particularly true for data-oriented designs and flow-based programming.
Also for libraries that other (C++) systems depend on.
There are C conventions that make "subclassing" easier. FWIW C99 made that simpler.
Opinion:
I'm tired of C++ trying to fix last version's problems with yet another complicated construct,
(auto_ptr? smart_ptr? unique_ptr? ...) requiring code restructuring in ways that other teams may have problems grokking. C++ seems to prefer hiding things, or at least slapping another coat of paint on them. Like getting from point A to point B via a Hilbert curve.
|
|
|
|
|
I do share your frustration with C++'s very much designed-by-committee** runtimes
** not that other languages aren't driven by standards bodies, but C++ very much "feels" like it is. Plowing through the STL standards is like trying to do pretty much anything at the DMV (at least in the states)
I can't find anything to argue about with your post in fact.
Real programmers use butterflies
|
|
|
|
|
I can't really advise you to use one over the other (as it's your personal preference), but I can tell you that I generally avoid doing C++ code over C for my own stuff.
Why? Perhaps I've been burned/annoyed by C++ too much over the decades (some of which may not be relevant anymore, but still has left a bitter taste)..
[rant-begin]
-- Mangling inconsistencies between compilers.
-- No unified naming conventions. Camel Case vs Pascal Case vs Snake Case.
-- Too much hungarian notation crap seen.
-- Headers with .hpp extension vs just .h (or worse, "standard" headers with no extension, causing pointless dummy files that include the real .h file in some implementations).
-- Overloading abused to non-intuitive things way too often.
-- Bloated / over-complex standard libraries.
-- The "new" C++ really should have been called something other than C++, since it has radically changed from early C++.
-- A bunch of translating back and forth needed when dealing with C APIs (most often C strings), which adds extra overhead.
-- .cpp files extensions. Always makes me think "C Pre-Processor", which predated C++. I mean, what where they thinking?! Though, .hpp files annoy me more. I use .cc when I must do C++ for my own projects.
-- Wrapping everything in "new" C++ (for memory/cleanup safety). Sure, it helps, but at what cost of hidden overhead, and is still no substitute for avoiding sloppy/undisciplined coding.
-- Bloated / over-complex standard libraries.. "I know that, technically, that’s only one drawback, but it was such a big one I thought I’d mention it twice." --Kryten/Red Dwarf
[rant-end]
In some cases I will still write a C++ wrapper for my C code, if it's a library, just for people who prefer using an OO API.
Now don't get me wrong.. some of the features of C++ are nice (like function grouping, protected methods, polymorphism), but often not worth the price of all the negatives.
|
|
|
|
|
The man at the door said I could get a good argument here!
veni bibi saltavi
|
|
|
|
|
To the soapb... oh.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
I'm sorry, but I'm not allowed to argue unless you've paid.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I paid the gentleman in the pink tutu at the door.
veni bibi saltavi
|
|
|
|
|
If you want me to go on arguing, you'll have to pay for another five minutes.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You're not Eric are you? I was told to ask for Eric.
veni bibi saltavi
|
|
|
|
|
No, he's an Idle
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Aside from everything else, being a comparative newcomer to this place (and seeing no other place around this place, this must be the place) - I have to ask. Which of the two in your picture is supposed to be you?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Which one was the Alien, and which the Predator?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I cautiously avoided asking if they were parental in nature. Now without a bottle of Gin in tow (and never put toe in Gin). After all, I don't know the guy as well as some of you beyond his poor taste in liquor.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I dunno, Gin can be rather pleasant, especially if you pour an unopened bottle of Vermouth into the glass.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: especially if you pour an unopened bottle of Vermouth into the glass. . . . and fill it to the top and skip the gin?
You'd probably be better off (flavor and aroma) by drinking witch hazel.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
No, the idea of the unopened bottle is that it lets the idea of Vermouth permeate the Gin* to create a truly Dry Martini.
* Instead of the actual substance, which would be a criminal offence.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Way back in the days of Prohibition (a funny little experiment that let religious fanatics tell everyone how to live) they produced a product called "Bathtub Gin[^]". It was so named because it's only redeeming quality was the (usually) drinkable alcohol.
That, however, would seem to be a step viz-a-viz production of the genuine article - worthy of production in that other floor-level container usually found in the same room as the bathtub.
Just sayin' . . . (and at least you got me to be positive about it)
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Do you just store them in the same cabinet?
Real programmers use butterflies
|
|
|
|
|
By preference, you don't store them in the same county.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I see what you did there, and I like it.
|
|
|
|
|
Nagy Vilmos wrote: The man at the door said I could get a good argument here!
Whisky is better than gin.
/trollface
Seriously though, welcome back. 🍻
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
'ello, decided the banter is better here?
|
|
|
|
|
I just posted a question at the top that could be taken as bait if someone were so inclined, though it wasn't written as bait, it's a C vs C++ thing, so I expect there to be casualties.
Real programmers use butterflies
|
|
|
|