C Is Now the Most Popular Programming Language, Claims TIOBE (jaxenter.com) 246
Charlotte Web writes: Since 2001 the TIOBE Index has been ranking top results for the search query +"<language> programming" on the top 25 search engines. "This month, C moved up past Java and entered the number one position," reports JAXenter.
"There's a new number one. (Or, should we say an old number one?)"
"Java and C were already very close in April, but this month C surpasses Java again," explains Paul Jansen CEO TIOBE Software. He also points out that the last time C was number one was back in 2015, suggesting that today embedded software languages like C and C++ "are gaining popularity because these are used in software for medical devices."
"On another note, it is also worth mentioning that Rust is really getting close to the top 20 now (from #27 to #21 within one month)."
"Perl, on the other hand, might be on its way off of the charts," argues JAXenter, "if it continues its downward trend. This month it saw a rate of change of -0.51%. It is currently number 18 on the list, but in May 2019 it was number 13."
Python also passed C++ to take the #3 spot, while C# overtook Visual Basic for the #5 spot. ("Classic Visual Basic" also lost the #16 spot to PL/SQL).
Even PHP rose a notch, pushing past SQL to take the #8 spot, and Scratch also moved up one, overtaking Objective C for the #19 position.
"There's a new number one. (Or, should we say an old number one?)"
"Java and C were already very close in April, but this month C surpasses Java again," explains Paul Jansen CEO TIOBE Software. He also points out that the last time C was number one was back in 2015, suggesting that today embedded software languages like C and C++ "are gaining popularity because these are used in software for medical devices."
"On another note, it is also worth mentioning that Rust is really getting close to the top 20 now (from #27 to #21 within one month)."
"Perl, on the other hand, might be on its way off of the charts," argues JAXenter, "if it continues its downward trend. This month it saw a rate of change of -0.51%. It is currently number 18 on the list, but in May 2019 it was number 13."
Python also passed C++ to take the #3 spot, while C# overtook Visual Basic for the #5 spot. ("Classic Visual Basic" also lost the #16 spot to PL/SQL).
Even PHP rose a notch, pushing past SQL to take the #8 spot, and Scratch also moved up one, overtaking Objective C for the #19 position.
Sceptical (Score:2)
There aren't many decent C programmers compared to other languages, when C++. And recruiters don't know the difference.
I'm thinking measurement error.
Re: Sceptical (Score:5, Insightful)
Re: (Score:2)
Ya, critical infrastructure cuts down on fashionable languages and newcomers. C hit the sweet spot here; high level enough to be useful in a wide variety of applications, low level enough to use it on bare metal, and reasonably easy to learn. It lacks the stringent orthodoxy of Python and C++, it doesn't have the constantly changing standards and styles of C++ or Java, it just gets the job done. For all those scripting languages out there, they're all written in C, or at least their first version was.
Re: (Score:3)
Java has no "changing standards" it only has evolving standards.
There most certainly is no single Java program that does not compile - or if it is already compiled - run on a modern VM.
For all those scripting languages out there, they're all written in C, or at least their first version was.
Unlikely, who would write a scripting language in C when he can use Pascal or C++?
Are you actually a programmer?
Re: (Score:2)
Re:Sceptical (Score:5, Informative)
There aren't many decent C programmers compared to other languages
That's right, only the good programmers even want to try!
In any case, embedded programming is hot, both professionally and with hobbyists, and C rules that domain. Plus most of the libraries for other languages are implemented in C, because of portability. Even when I was a Ruby programmer it was half C integration.
C++ libraries are often just C libraries with C++ wrappers.
C is everywhere. I even write web applications in C.
Re: (Score:3)
In any case, embedded programming is hot, both professionally and with hobbyists, and C rules that domain.
I have programmed embedded PIC, STM8, STM32, and MIPS. Have a nice STM8 library and project example ecosystem on github. But no luck finding work. Care to point out a place to go looking? Linkedin has done nothing. And it must be remote (I have years of well-paid remote history.)
Thanks, and any tips will help others with similar situations.
Re: (Score:2)
That's the problem with embedded stuff - they want you to be in the lab with all the gear. Learn to code! In JavaScript!
Re: (Score:3)
Don't forget that there's still a demand for Cobol programmers.
Now write a web app in Cobol.
Re: (Score:2)
MicroFocus is eager to show you how!
https://www.microfocus.com/doc... [microfocus.com]
Re: (Score:2)
Or if you want FORTRAN, you can do that too: https://fortran.io/ [fortran.io]
Re: (Score:3)
It should be encouraged to read all the Cobol code with a robotic voice.
There's no language that looks more like "sci-fi robot talk" than Cobol.
Re: (Score:2)
Like this? https://www.bedug.com/pics/Fun... [bedug.com]
Re: (Score:2)
C++ libraries are often just C libraries with C++ wrappers.
Other than system libraries, I would guess that few are that way.
Re: (Score:2)
Re: (Score:3)
I like C and also I like C++, but I DO NOT like the over-use of classical object oriented design patterns to the point of making code unmaintainable. There is an extreme end of object oriented design which is, in my opinion, simply too far. The end result is an explosion in the number of lines of code, and the number of logical layers in the code, far beyond necessity.
There is always a justification that this will make the code easier to test and easier to maintain in the long run. My challenge is: it ac
Re: (Score:3)
C is everywhere.
C is everything.
C is everybody.
C is still the king.
Re: (Score:2)
Huh. I was thinking "gee if it really was for last month or the month before then suddenly a lot of students are having to search online for homework/project help"
Re: (Score:2)
Naw, it's still popular. But... don't believe these statistics anyway, there's nothing scientific about them. Self selected polls, looking at people who ask questions online, etc.
Also, how you define "popular" is ambiguous. If you count number of CPUs that a language is used on, the C wins by a huge margin (counting 8, 16, 32 bit embedded CPUs probably outnumbers PCs and tablets and smartphones by a good margin). If you count who is using it, then maybe C drops down a bit, probably Python wins there if y
Re: (Score:2)
I don't think it's hard to find people who have years to decades of experience in C. That's like, every programmer over 40.
Bah (Score:5, Funny)
either use a magnet to flip the core bits by hand, or go home.
(and, no, cat gut programming doesn't count)
hawk
p.s. now get off my lawn
Obligatory XKCD (Score:4, Funny)
https://xkcd.com/378/ [xkcd.com]
Re: (Score:3)
either use a magnet to flip the core bits by hand, or go home.
Flipping bits? What sort of new-fangled nonsense it that? How could you even know what was in memory if it can change? Real men use core rope memory [wikipedia.org] that was hand-woven by real women! If you're such a failure that you need to patch your code, you'll have to wait a week for memory to be re-woven.
Kids these days don't know. In my day all there was were 1s and 0s, and they were all out of 1s!
Re: (Score:2)
He joined /. before 2000 when the site was still new.
Obligatory Dennis Ritchie Quote (Score:4, Interesting)
“C++ and Java, say, are presumably growing faster than plain C, but I bet C will still be around.”
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
And of course, C++ is a language for programmers who have no sense of elegance.
Oh, we have a sense of elegance, all right -- we notice its absence on daily basis. :(
Popularity of search or of programming? (Score:5, Insightful)
Popularity measured by search queries wouldn't say anything about the popularity of the language usage.
Certainly, I would search for "python programming" when I don't know python, when I'm learning python, or when I'm applying for a job and think I might need to learn python. Realistically, how often would I search for "python programming" when I use python all day everyday?
Personally, well, professionally, I use Perl, and have for 25 years. I use it all day every day.
How often do I look up perl syntax? About twice a day. You better believe I'm not querying the entire web for it. Welcome to perldoc.
How often do I look up any perl help (non-syntax) at all? Maybe once a month.
There's no way for any company to measure how much I use perl. It's simply not externally exposed. None of my clients' web-sites or systems or apps expose what language they are built in.
So, at best, this measures the growth (and decline) in the trouble of learning each language. Fun.
Re: (Score:2)
Re: (Score:2)
Perl's really "easy" to learn -- when "easy" means steep-but-short learning curve.
~190 functions to learn. Use ~50 of them routinely, and another ~50 occasionally.
I'm not looking up normal functions. Maybe some weird regular expression questions, or some optional function parameters. Probably look up the same things every month.
My point here was that it's not a "search" and it's not a "question". It's a simple reference to the one place that has everything exactly the same way for decades now. It's com
Re: (Score:2)
Why include SQL in a list of programing languages? (Score:2)
Why would you include SQL (and PL/SQL) in a list of programing languages? It's not like you can use SQL instead of C/Java/Python rather than along-side them.
Re: (Score:2)
Depends on how you define a programming language. While SQL may not have a for-next loop or other iteration, it does have if-then type logic available (or at least, some flavors/implementations do)
Re: (Score:2)
SQL in fact does have looping constructs, particularly a WHILE loop. No, it's not a general purpose language, but it certainly is a programming language.
Re: (Score:2)
Many programming languages have specialized purposes. Javascript runs almost exclusively within Web pages. You can't write a device driver with bash or PowerShell. ABAP runs only inside of SAP. PostScript is used almost entirely by printers.
Just because a language is a special purpose language, doesn't make it "not a language."
SQL is in every way a programming language. It has syntax, variables, conditions, calculations, loops, input, and output. No, it can't create an Android app, but then, neither can Swi
C harder to memorize (Score:2)
I've written C or C++ code since 1994. I still have to often look up syntax, especially for the many libraries that do not conform to any particular pattern. C is probably searched more often than other popular languages because it's more necessary to look up patterns and syntax every time you do something, particularly in the embedded world where C predominates.
Re: (Score:2)
I know there's a corner of the IoT world so constrained where those concerns just don't arise: no malloc or free in the first place
Arduino has malloc() and free() it you want it but almost nobody does.
Re: (Score:2)
On a small processor like the Atmel on an Arduino, if you are allocating and freeing memory like that, you're probably gonna run out pretty fast. Static memory declaration up at the top of the program, is more the norm.
This isn't web programming we are talking about. And the 'application' isn't riding on an operating system.
Sure, but the claim was: "no malloc or free in the first place"
On a slightly bigger "IOT" CPU like the ESP32 there's a place for dynamically allocating things like network connections. I wouldn't use malloc() though, I'd use new.
Re: (Score:2)
For objects yes, new does more than malloc. For new char[256] however it's essentially identical to malloc except that it can throw an exception and malloc returns an error code. In Embedded C++, new returns an error code (and thus isn't 100% a strict subset).
Re: (Score:2)
Even with larger memory you can screw up with malloc/free, or new/delete. Memory gets fragmented easily with certain allocation patterns. Systems with virtual memory tend to do better as you can swap out unused pages, but it's still an issue there. If your system needs to run 24/7 for a year or more without crashing and without crashing then you want to avoid arbitrary use of the heap, or use an application language that has classical copying garbage collection. use the heap on bootup to make your memory
Re: (Score:2)
Embedded, libraries for most other languages, embedded, drivers, embedded, legacy, embedded. Oh, and embedded. Servers. embedded. Systems.
Re: (Score:2)
There aren't really any more kernel, driver, or systems programmer jobs than 20 years ago, though (and systems programming is usually C++). Device-side programming for server room use is more common (storage arrays and the like), but that's also commonly C++, just avoiding the slower libraries.
I know there's an explosion of IoT embedded programming, and far more jobs there than classic embedded programming, but it's hard to believe that's more prevalent than boring old Java code that solves business proble
Re: (Score:2)
I know there's a corner of the IoT world so constrained where those concerns just don't arise: no malloc or free in the first place, no no worries about leaks or dangling pointers. All fixed-sized data, so n worries about buffer overruns.
Even the C functions intended for fixed-size buffers, like strncpy(), are notoriously difficult to use correctly. You can very easily end up with unterminated strings using this function on fixed-sized data.
Re: (Score:2)
"Fixed sized data" is a broader idea than "fixed sized buffers". I spent the first 5 years of my career doing assembly language coding with no objects at all that were runtime-variable in size. There was no string concatenation, for example.
These days I'd do the same in C. You'd never use strncpy() or strncpy_s() or strncpy_safe() or strncpy_really_safe_this_time_we_promise(), it's all memcpy() with sizeof(). Never even think about null-termination of strings, because they're always treated as fixed-siz
Re: (Score:2)
Re: (Score:2)
Possibly you are thinking of Rusty's API Design Manifesto [the-davies.net] ?
Re: (Score:2)
Even the C functions intended for fixed-size buffers, like strncpy(), are notoriously difficult to use correctly.
That's why professionals typically write their own set of string functions (or at least macros)
What's Linux? (Score:2)
Linux is indeed a large, complex program which will run on something like a Raspberry Pi. If you want even complex software to run on something much less expensive than a desktop PC, maybe people should write in the language that written in. It seems to work well for high-performance programming on limited hardware. What language is used to write Linux? Is Linux a Java project?
Of course with a Raspberry Pi we're talking about hardware that's cheap compared to a $2,000 laptop. I recently did a project on
Re: (Score:3)
In general I agree, although I recently used MicroPython* on ESP32 and the dev experience was really great. Obviously it's not full-fledged Python, but it's far more complete than I would have expected. I planned on doing some prototyping with it and in the end just stuck with Python for the whole thing. There are definitely cases where it'd be too big/slow but I had plenty of resources for what I was doing.
* See e.g. https://docs.micropython.org/e... [micropython.org]
Re: (Score:2)
Interesting, thanks. I had looked at micro Python. If I were a big fan of Python, I probably would have used it. As it is, I used Perl for 15 years before Python became popular.
Re: (Score:2)
If you have room to run Linux, you probably have room to run Java. It's hard to think of anything that can run a full OS as an "embedded" or "constrained" environment.
I'm aware there are exceptions, where people shoehorn a carefully crafted Linux distro into 80% of the resources of a device leaving you precious little remaining to code in. And that can be the right choice to preserve the coding environment you're familiar and comfortable with, and just "get shit done."
Now, if you're in an environment that
Re: (Score:2)
I am surprised about that too. I know that everywhere there is UNIX, there is C, and it is often the language of choice for low level programming.
However, I didn't see that many "C programmers". Programmers who know C, sure, plenty, but much fewer for which it is their day job.
For large project, C++ is often preferred. C++ performance can match that of C. One, after all, is (almost) a subset of the other, and they usually run on top of the same compiler back-end.
For embedded systems, C is certainly popular
Re: (Score:3)
I am not even sure why this is a question. C is pretty good for non-trivial programming. It's not so great for *trivial* programming, like web apps and networking and database garbage.
Re: (Score:2)
I don't know anyone who is paid full time to write C code that isn't a kernel or IoT device programmer. So where is all this new use of C coming from? Some massive explosion in IoT programming? Something new?
Re:What are people using C for? (Score:5, Informative)
I don't know anyone who is paid full time to write C code that isn't a kernel or IoT device programmer.
You do now. I'm in embedded, and work with lots of people who don't want to learn a language that is almost 4x the size of C for no good reason. And there's no such thing as "just use a subset of the language"; that never works out for any language, not just C++.
When you're writing critical stuff (think detonator controllers) you can't afford to have a language that isn't easily reviewed in diffs; don't overload functions because an incorrect call won't show up in the diff, don't use optional parameters because reading a call to the function doesn't show that it is being silently invoked with parameters that subtly change behaviour, and are you really sure which polymorphic function will be called at runtime with this class hierarchy?
Rather than shout at developers "Don't do that", rather just use a language that doesn't let you do that.
The difference between C and C++ is that this line of code
int x = foo (y);
In C has only a single meaning - the function 'foo' will be called with exactly one parameter, and 'y' will not be changed by foo.
In C++ the reader will first have to determine if there are overloads, and if so what the type of 'y' is to determine which function will be called. Then the reader will have check the function prototype to see if any invisible default values are being passed on, and if the reader says "well, it's optional and so probably a sane default was chosen", the reader still has to check the prototype anyway, because 'foo' may have been specified as taking a reference!
Re: (Score:2)
Well, I'm not sure how your calling function without looking at the prototype and associated docs to see what the function does, but there's no doubt that C++ is a language full of footguns. There's was never much of a point to C++ if you're just passing around a bunch of ints, anyhow.
I could see back in the day of "EMACS vs VI" wanting everything as simple as possible, but in the modern world hovering over a function call shows you the signature and associated comments, so that's not a real concern, and s
Re: (Score:2)
Well, I'm not sure how your calling function without looking at the prototype and associated docs to see what the function does,
I'm not sure how you could miss the words diff and code reviews in my post, but it happened anyway. The important point you are missing is that we read code more than we write it.
When you're reading and you come across this:
foo (y); you may not actually be interested in what foo does anyway because you're reading this line as you make your way down to the part you are really interested in. In C++, a line like this might result in 'y' being modified. You aren't interested in the function, but each func
Re: (Score:2)
I'm not sure how you could miss the words diff and code reviews in my post, but it happened anyway. The important point you are missing is that we read code more than we write it. ... all the hovering in the world is not going get bitbucket to give the the correct function prototype on an overloaded function in the diff.
Err, there are ways to do CRs in an IDE environment, you know? Maybe he doesn't know. You'd have a better point if you were talking about long-after-the fact spelunking in change history to try to figure out whether that thing that changed 5 diffs ago was intended, or a bug that slipped past CR.
Anyway, above you said
The difference between C and C++ is that this line of code
int x = foo (y);
In C has only a single meaning - the function 'foo' will be called with exactly one parameter, and 'y' will not be changed by foo.
But if you're not enforcing coding standards that keep people from doing silly things, then you get:
#define foo(y) bar(* y, DEFAULT_VALUE)
Or something equally annoying that actually did make s
Re: (Score:2)
In C++, that one line might result in an extra 64K or more of code size, even if foo is in a library.
Re: (Score:3)
For me, the big win with using C++ as "C with classes" in embedded is for the ability to have a specific set of functions automatically associated with a struct of data, that is:
automatic - don't have to manually initialize them
managed - can't forget to initialize one or more function pointers, or use a wrong one, they are all together in the vtable, and you automatically get the right set of functions when using sub-classes
immutable - can't accidentally overwrite one of the function pointers if the vta
Re: (Score:3)
Network appliances. Network security appliances. Storage appliances. OS & Systems level programming. The list goes on, but those are easy ones.
Anything where you need low latency (microseconds, not milliseconds) and maximum possible throughput on the available hardware.
Re: (Score:2)
Network appliances. Network security appliances. Storage appliances. OS & Systems level programming. The list goes on, but those are easy ones.
None of those are more common than before, proportional to the industry, unless you mean to include IoT in "network appliances". The percentage of people doing any kind of systems or kernel programming on servers or server-room devices is tiny compared to 20 years ago.
So, are we talking IoT programming? Someone has to code up all those "Smart TVs" and make sure all the personal data harvesting works, sure, but I wouldn't think that was all that big, job-wise.
Re: (Score:2)
Re: (Score:2)
TFS is about the growth of C. So it's not about what is C "still used for", it's what C is "newly used for", such that it can become the most popular language (at least in searches).
Re: What are people using C for? (Score:2)
Re: (Score:2)
In response to a story about the growth of C. So what's new? The old uses of C get proportionally smaller every year, because of the eternal growth of boring old Java business code, so what are people using C for these days? It's clearly not merely what people were using C for 20 years ago, or the language would be a small niche. There must be something new.
And I think it is hobbyist and IoT programming, the re-invigoration of low-level coding on tiny cheap devices. Given what's being measured is searc
Re: (Score:2)
For real problems these days, you have to write distributed code and scale horizontally. That's possible to do in C, of course, but the overlap of "understands distributed programming" and "writes tight C code" is so small that I'd despair of ever being able to hire anyone. Much easier and cheaper just to run 40,000 cores for a few hours than try to do it in C just to get that down to 10,000 cores for a few hours.
I mean, there are places where the distributed part just comes naturally, such as rendering,
Re:Haven't you heard? (Score:5, Informative)
Heck, it's been 20 years since I've seen any problem in my own career that was CPU-bound performance-wise...
You must do really boring shit.
Nearly 30 years of game programming and embedded work, just about all of it is resource constrained, CPU bound or memory bound.
Re: (Score:2)
Some it it was quite exciting, but it's all distributed code. Everything interesting ends up being I/O bound, and performance problems are solved though horizontal scalability.
Re: (Score:3)
OK, are we mod-bombing technical discussions because of what people say in political discussion now on Slashdot? Have we just fully become Reddit?
Re: Haven't you heard? (Score:2)
Re: (Score:2)
Yeah, the evidence strongly supports that, I have to admit.
Re: (Score:2)
Sure, apart from all the constant reinvention of very basic wheels, the laughable string handling, the lack of error handling, lack of support for anything except procedural programming, lack of scalability to any real size program, etc.
All of which were solved by C++ about 20 years ago and all of which lead to bugs and memory corruption as you use malloc() to manually re-implement your linked lists for the 10,000th time.
Re: (Score:2)
Sure, apart from all the constant reinvention of very basic wheels, the laughable string handling, the lack of error handling, lack of support for anything except procedural programming, lack of scalability to any real size program, etc.
One fo the most complex, distributed and largest software projects in the world use C.
All of which were solved by C++ about 20 years ago and all of which lead to bugs and memory corruption as you use malloc() to manually re-implement your linked lists for the 10,000th time.
The reason that quite a few projects prefer C to C++ is because C has much fewer opportunities for error or unreadable code. C++ has all the traps of C, and then adds double as much of its own.
Re: (Score:3)
The one thing that I really miss from C++ when I'm writing C code, and that I wish could be added to the C language somehow, is constructors and destructors.
Having constructors and destructors in C++ enables RIAA-style automated resource tracking, which (used judiciously) eliminates the entire category of leaked-resource and premature-freeing-of-resource bugs that C programmers have to deal with.
Re: (Score:2)
A THOUSAND LAYERS OF ABSTRACTION that makes debug almost impossible
That's one of the advantages of C, a single layer there will do to make debugging impossible.
Re: (Score:3)
All those embedded device,.. are programmed in C++.
Dude. Have you ever even read a data sheet? Or a header file? Any C++ is wrappers around the C functions, and non-arduino people are usually using C. Often C99.
If you're doing embedded programming you deal with the low level details of compiler options, so your theory that people don't know is amusing.
Re: (Score:2)
Your assumtion that TIOBE is asking that specific group of programmers what language they use is amusing.
They get their numbers by crawling the web and scraping web pages.
Re: (Score:2)
Your assumption that my comments were that centered on TIOBE was entirely unfounded. Entirely. I never mentioned them, and the headline is about the claim, not about the people who made it.
It is entirely possible that people are discussing the claim on its own merits, and not internally phrasing their own thinking in the context of TIOBE. I mean, gosh, who does that?
Re: (Score:2)
There's lots of amateur embedded programming these days, though. It's the whole revitalization of low-level programming thanks to cheap devices. I know there are people writing fairly casual embedded C code for a living, as the entire team is all young hobbyists with no "old heads". But I wouldn't think it was more common than Java.
There's lots of Professional embedded programming (Score:2)
in C - especially when you get the current class of ARM Cortex or MIPS processors. They're 32bit and have Megabytes of Flash and tens to hundreds of kilobytes of SRAM.
C++ generally doesn't fit that application well, especially when you start working with RTOS's - they generally don't have good memory management models to support the efficient creation and deletion of objects. It should also be pointed out that vendor drivers generally don't work well with C++, they're written almost exclusively for C.
Re:There's lots of Professional embedded programmi (Score:4, Interesting)
they generally don't have good memory management models to support the efficient creation and deletion of objects
If everything is pre-allocated, then there's not much difference between C and C++ in practice. If objects are dynamically allocated, but that's done cleverly, though slab allocation and custom memory managers, that's why you can overload the "new" operator in C++. Not that that necessarily recommends C++, but it's not a performance concern. There are almost no performance concerns with C++ that don't come down to lack of familiarity with the language. Not that that necessarily recommends C++.
It should also be pointed out that vendor drivers generally don't work well with C++, they're written almost exclusively for C.
True story.
Re: (Score:2)
Well. there can be those with lots of familiarity wtih C++, lots of expertise, but it's all in the amazingly bloated and low performance world of PC (windows or linux both). That does not translate well to writing C++ efficiently for low level purposes. I'm amazed sometimes at how some will write pages and pages of framework just to avoid one extra line of low level code or to provide a more complicated way to avoid freeing memory. If you think freeing memory is something that should happen behind the sce
Re: (Score:2)
Almost everybody is using C99 because of inline functions, stdbool.h, and inttypes.h
There is no pain going forwards from C89 to C99, and the changes make life easier for embedded.
C11 gets used more on 64 bit, so it should become more popular with RISC-V adoption. And when using threads.
There is definitely the belief in embedded C that you should not switch to requiring the new version until you actually need the features. Note that it isn't until you actually used the features; but when you actually needed
Re: (Score:2)
non-arduino people are usually using C. Often C99.
Mostly for administrative or cultural reasons, not because it's somehow superior to C++.
A C++ programmer can do anything a C programmer can, and a lot more besides.
As soon as you have more than one of anything with state (eg. a toggle switch) then C++ objects make your code cleaner.
Yes, the compiler WILL optimize all the "class" part away into single I/O instructions.
Re: (Score:2)
non-arduino people are usually using C. Often C99.
Mostly for administrative or cultural reasons, not because it's somehow superior to C++.
They feel that having a simpler language that maps more directly to the processor is superior. Of course, after having seen you display a profound lack of knowledge about programming in this thread, it makes sense that you would put it dismiss anything that doesn't match your worldview.
A C++ programmer can do anything a C programmer can, and a lot more besides.
Sure, except that the cognitive load for using C++ is an order of a magnitude more than using C. Some people will call "easier" a superior solution.
Re: (Score:2)
A C++ programmer can do anything a C programmer can, and a lot more besides.
Sure, except that the cognitive load for using C++ is an order of a magnitude more than using C. Some people will call "easier" a superior solution.
You don't have to use all of C++.
There's a lot of things in C++ that massively reduce the cognitive load, eg. function overloading - you don't need a new function name for every last combination of data types.
Then there's the "auto" keyword.... etc,. etc.
Re: (Score:2)
A C++ programmer can do anything a C programmer can, and a lot more besides.
Um, I have a lot of experience with people for whom that statement is wrong.
Ie, I knew someone, paid more than me, who needed to compare two C style strings. He converted both to C++ strings, then did an "==". That actually added ~200K to the code as the first user of c++ strings and it no longer fit in the available memory. I had to show up on the weekend to fix it, and his claim was that he didn't know about strcmp (even though it's a part of standard C++ forever).
I now some who literally cannot write a
Re: (Score:3)
If your programmer doesn't know about strcmp() then C doesn't fix the problem.
You'd still have had to show up on the weekend.
Re: (Score:2)
I don't mind C++ for embedded systems as long as it's a subset of C++. ie, Embedded=C++ or similar. That is, no exceptions, no RTTI, only limited small uses of templates, no Boost, or other things that typically lead to large code or slow performance behind the scenes. Use a better-C-than-C approach, with added modularity because you have namespaces and classes. I used to program that way, it's not hard.
And yet I'd see others who would do something silly because their toolchest only contained std:: stuff
Re: (Score:2)
Well, it's fine to call it "C" if you're writing valid C code and just happen to be using a C++ compiler, no? The corner cases where it actually matters that you pass the command line flags to force C mode aren't going to come up that often in casual code.
Re: (Score:2)
Well, it's fine to call it "C" if you're writing valid C code and just happen to be using a C++ compiler, no?
Only if you promise to never, ever use a single library that's written in C++. :-)
(which will be damn difficult these days)
Re: (Score:3)
It's a good goal to avoid them. Most of the standard libraries are 95% in header files. Ie, they're templates, and every instantiation adds more code. Templates are essentially smart macros, and if you realize that they can bloat the code then you can use them judiciously so that there is actual sharing of object code. But a lot of programmers treat them like they're in a shared library and that one line of C++ code compiles to be just as small as any other line of C++ code.
Take that style of programmer a
Re: (Score:3)
This. Learning how to do a "C with classes" for embedded can be very useful. The basic concept is that a class is simply a struct with functions bound to it, using a vtable with a read-only list of function pointers that don't require horrible syntax or manual initialization. The most useful thing is to make a class declaration represent an API of some hardware thing, and create an object for each one you're using. (see the mbed environment for an example) And if you understand what name mangling is, you ca
Re: (Score:2)
What are people using C for these days? There are very few resource-constrained environments these days, when Linux will run on very cheap hardware indeed. IoT devices?
Nope. All those embedded devices, Arduinos, ESP32s, etc., are programmed in C++.
No, they are not. They use a stripped down subset of C++. Good luck using any C++ idioms other than inheritance.
I suspect it's more a case of people not actually knowing what language they're using
Pot, meet kettle.
Re: (Score:2)
Namespaces. I which C had namespaces. Stronger typing; a blessing and a curse, depending upon if you're writing new code versus shoehorning in old code. Optional parameters. Even judicial use of overloading.
Re: (Score:2)
No, they are not. They use a stripped down subset of C++. Good luck using any C++ idioms other than inheritance.
You can use classes without inheritance.
As soon as you need more than one of anything that has associated state then an object makes life a whole lot easier and the code a whole lot cleaner.
I suspect it's more a case of people not actually knowing what language they're using
Pot, meet kettle.
Quite.
Re: (Score:2)
Re: (Score:2)
But I mainly use this device to look at ass, or well naked bits in general, so he's not wrong.