15 ms·
I can't tell if this is serious. Surely if you're still using C now it's for legacy reasons. And if using it for legacy reasons you are likely stuck using an o
by mungoman2 5y ago
I can't tell if this is serious.
Surely if you're still using C now it's for legacy reasons. And if using it for legacy reasons you are likely stuck using an old C standard.
So who will use C23?
- jonp888 5y agoThere are many many people out there using C for embedded software.
- sam_bristow 5y agoThe problem is that embedded compilers are not known for keeping up with the standards. The only hope is that the moves to GCC and Clang continue.
- pkrumins 5y agoNo one cares about the standards. We only care about getting things done by writing regular C code that works.
- uncomputation 5y agoHuh? What do you think defines “regular C code that works”? Standards. Every compiler you have used operates at a bare minimum on the C standard. That’s why they are often advertised (if not GCC/Clang which are assumed to be up to date) as “C(89|99|11|17) compliant.” “Code that works” is code which is operates under constraints and guarantees specified by a standard, anything else is undefined or unportable.
- flyinglizard 5y agoEmbedded environments are specific and esoteric enough that compiler portability is the least of your concern when migrating code from one platform to the other.
- pkrumins 5y agoOnly the standards people care about standards. We (programmers) want to just get things done. We don't care about the standards. No one reads the standards. Also no one cares about portability. All computers have been the same for the last 20 years.
- drran 5y agoWe, developers, care about standards, because we want to get things done once.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- pjmlp 5y agoRight, then comes the day another OS or CPU needs to be supported and some clever developers learn their lesson about language standards during a couple of late nights tracking down production issues.
- xigoi 5y agoI'll rather have code that runs on an actual computer than code that should hypothetically run according to a long document that costs 60 dollars to read.
- pkrumins 5y agoExactly. You get it 100%. We should work together.
- bsder 5y agogcc (thankfully) is the default (you download gcc compiled for ARM directly from ARM itself) for ARM embedded so when gcc gets it, ARM gets it. So, presumably, RISC-V will also get it at the same time.
- mkl95 5y agoThere are tons of CPython users AKA Python's default implementation... the software world is full of high level abstractions built on top of C.
- pkrumins 5y agoWe all use C because it works and we love to get things done.
- drran 5y agoNot all of us use C, because it's very easy to create security holes in C. For example, web browsers are using slow JavaScript just because it memory safe.
- deleted 5y ago[deleted]
- dkjaudyeqooe 5y agoC is a portable alternative to assembly language.
- pjmlp 5y agoWhen the world is a PDP-11.
- nec4b 5y agoAnd x86, Arm, PIC, Xtensa,... and everything else.
- pjmlp 5y agoThere is where you went off rails, with greetings from ACM. https://queue.acm.org/detail.cfm?id=3212479 https://queue.acm.org/detail.cfm?id=3212479
- nec4b 5y agoI'm so glad that you have linked this article from Chisnall. I can now ask you in what ways is the abstract model of a machine on which assembly language operates on, different from the one on which the C language operates on? This is the claim which started this thread: >>C is a portable alternative to assembly language.
- pjmlp 5y agoC's abstract machine is leaky and full of surprises when UB comes into play for one. Second when people talk about C being portable Assembly, they mistakenly assume to know what comes out of the compiler's backend. Third, unless we are speaking about PDP-11 like CPUs, modern CPUs have tons of capabilities not exposed to ISO C. Finally, since 1958 there are portable alternatives to Assembly in systems programming with JOVIAL being one of the first remarkable ones, yet another thing that C did not invent.
- brian_cloutier 5y agoAt a previous employer of mine we would have happily switched to c23. Postgres is written in c and if you want to write an extension for Postgres you're going to have the easiest time if your extension is also written in c. However, there's no reason not to use the newest c version. So, c is not just for legacy code.
- kstenerud 5y agoI will. C is everywhere and is not going away (it's #2 on TIOBE and on the rise again). Now that fewer people are learning it, I get more juicy contracts.
- reassembled 5y agoI feel like there’s actually a growing subculture of C programmers of late, seemingly spawned by Casey Muratori’s Handmade Hero series, Zed Shaw’s “Learn C The Hard” way and other more recent popularizations of C and low level programming ideas. There’s a whole “Handmade” software scene growing up, seemingly as a reaction against the bloat and over engineering of more recent software trends like Electron and web apps. Just the other day I stumbled across a vibrant Discord group focused on a fairly new but surprisingly feature complete game engine called Gunslinger, written entirely in C99. I’ve been working on my own C-based game engine for awhile too after having been exposed to the ideas of Handmade Hero, as well as from the influence of a good friend who has been writing games in C for many years. He’s now working on an application called Pixel CNC for generating 3D tool paths from 2D images.
- saagarjha 5y ago> seemingly spawned by Casey Muratori’s Handmade Hero series, Zed Shaw’s “Learn C The Hard” way It's kind of unfortunately, really, because both authors have very skewed viewpoints of C that are arguably quite incorrect.
- edflsafoiewq 5y agoWhat viewpoints are those, for those of us unfamiliar?
- saagarjha 5y agoZed Shaw doesn't really like C because it lets you shoot yourself in the foot. This is an OK opinion to have, but then he goes and writes books about C that basically talk about how the language is bad (ok, I guess?) but the then claims he has solutions to these problems, without understanding that the problems he has with C are not solvable within the language (for example, when handed an arbitrary pointer, there is no way to tell whether it is valid). Casey Muratori is fundamentally at odds with how undefined behavior works in C and has opinions™ on how to fix the language to make things work the way he wants them to, when in reality he just probably wants another language.
- aardvark179 5y agoHuge amounts of software are “legacy” but built with perfectly modern tool chains and will support c23 just fine. Even for large bits of software which have been mostly rewritten you’ll often find core libraries that are still actively developed but have never been ported away from C.
- sgt 5y agoSounds like you're not really in touch with the real word. C has many benefits and it is super practical. Yes, you can write unsafe code, but safety isn't always your #1 priority. There are also tools you can use to identify issues, which will mitigate risks.
- KnobbleMcKnees 5y agoI'm really starting to believe that there's a cohort of modern programmers that only see programming languages in terms of the high level syntactical features they provide. The logic of it is something like: I write the code, I run a command written using similar code, scenes deleted, my program runs and my IDE tells me if there are problems in my code. This is sometimes defined as the difference between developers and engineers, but I don't really buy the analogy because they're mostly highly competent and able to build solid and principled architecture into their software. This is the only reason I can summise that educated programmers would say something like C is irrelevant. I guess not everyone needs to have a depth of understanding of the platforms that underly their languages of choice, but - as demonstrated here - it certainly doesn't inform the future of languages when they are inherently tied to their ability to integrate with different hardware and OSs.
- pjmlp 5y agoIt was already irrelevant when using MS-DOS with Turbo Pascal/Modula-2/Basic compilers, or Mac OS (originally written in Object Pascal/Assembly). It was UNIX industry adoption, followed by GNU Manifesto that made to more relevant than it should ever have been.
- rixed 5y agoSo, it's not relevant, but then it's more relevant? Well, sure, merit and popularity rarely align, and one with enough technical culture can always imagine a better world.
- Koshkin 5y agoThe truth is, C is merely a historical artifact, one step above the PDP-11 assembly, created in order to make the UNIX source code portable. It has transcended its original purpose, and with it being elegant and simple as it is, I would still never trust it to run a pacemaker.
- rwmj 5y agoMany things on a Linux system is written in C, and despite the noise on HN, developers who gets stuff done are constantly writing new code in C all the time.
- pjmlp 5y agoIncluding plenty of new CVEs, we have to keep the security industry job market safe.
- rwmj 5y agoSure, I'm certainly not arguing that C is a good language. In RHEL we turn all warnings on, compile everything with hardening flags, use valgrind during development, and feed everything through Coverity.
- pjmlp 5y agoThe exception that confirms the rule.
- rossy 5y agoThe exception? It's standard practice for distros to compile with hardening flags, and if RH submits the bugs they find with Coverity upstream, that protects the 1000s of C projects they package.
- pjmlp 5y agoStandard practice they say, https://googleprojectzero.blogspot.com/2021/12/this-shouldnt-have-happened.html https://googleprojectzero.blogspot.com/2021/12/this-shouldnt...
- torstenvl 5y agoMozilla is not a Linux distro. You have made dozens of negative (and sometimes rude) comments in this thread. I'm curious why you're spending so much time and energy being negative. If C isn't something you're interested in, why not just ignore it and move on?
- DyslexicAtheist 5y ago> So who will use C23 I can't say if I'd immediately jump to C23 but I'll be thrilled to give it a try. Currently I'm rewriting an entire automotive OCPP charging point and it's associated CSMS in C because the original dev (who has no experience with Edge/IoT and just Cloud/SaaS) thought it was a great idea to implement this in golang. The binary size alone is already a problem where all I have is 30MB (needs to be shared with logs, sqlite, and 2 another "user-space" application). I could have chosen Rust/Zig/Nim (I really wanted to) but the client rejected it for very good reasons that have nothing to do with type-safety/performance/security but are all about good-business practice and risk management: - when I leave in a few weeks, there are plenty engineers inside the company who can maintain the system. - the domain is quite niche so to understand their solutions and requirements you can't do away without an occasional trip to their office. the client is not in a capital city with a vibrant tech-scene and weekly meet-ups and lacks the talent-pool. The constraints by the market (scarcity) makes Rust/Nim/Zig (my personal front-runners) very risky tools. C++ could have been an option but it's total overkill because most of the components you need to build this (websocket, mqtt, http, sqlite, zlib, openssl, ...) are anyway implemented in C and I actually don't want things like exceptions or templates in this _at all_ for performance reasons. If you split your OS into layers from HW (ring-0) all the way to layer-5 (process management e.g. systemd etc) then 99% is still written in C. So your argument throws every layer under the bus except user-land (L-6). C isn't going away only because of embedded/IoT. It's going to stay because choosing a language is like the "3 most important rules in real-estate: location. location. location". The language is your location and your primary lock-in factor for your solution/business. Once you've decided on language the only way to change this is an entire re-write. Even if you rewrite you still have to consider culture and available resources that must be in place long before you chose the programming language. And keep in mind the people who all took stakes in the original implementation and must all be sold on the idea that whatever new replaces the old "is sooo much better". That's not an engineering problem but a power/people problem. Edit: So just because "the engineer inside of me" wants to use Rust/Nim/Zig or whatever new to satisfy my intellectual curiosity is not enough reason. In fact my potential inability to see beyond that is a good reason for them to be very very careful about what advise I give.
- WithinReason 5y ago
- 10x-dev 5y agoC is the best choice if you want all of: small (both language and binaries), fast (both compiler and binaries), obvious (no/minimal complex magic), close to the metal, with excellent debugging support, portability and integrations. No other language has been battle tested for longer and more extensively than C. Your kernels, OSes, drivers, databases, web servers and compilers are written in C. If some of these features are not important to you, there are hundreds of slower, more complex and less portable languages to choose from, that provide other benefits instead, such as more convenience, more correctness and higher level abstractions.
- WithinReason 5y agoLanguages exist that compile to C which gives them many of the above advantages and more, so why choose C over them?
- raptorfactor 5y agoHaving never used such a language, I'm curious, what's the debugging experience like? Can I source level step the application in the original language or do I have to debug the generated C?
- rwmj 5y agoOne of the criteria is "excellent debugging support" which you don't get with transpiled languages, since you'll be buried in generated code when you open the debugger.
- shakna 5y agoHow many of your preferred programming languages are written in C? Yes, many self-host, but a considerable number of them don't want the complications that can bring.
- pjmlp 5y agoModern C compilers are written in C++. So much for C's simplicity in writing compilers.
- shakna 5y agoYes, C can be simple for writing a compiler. [0][1] No, optimisation, on the other hand, is not a simple problem. [0] https://github.com/rui314/8cc https://github.com/rui314/8cc [1] https://github.com/rui314/chibicc https://github.com/rui314/chibicc
- pjmlp 5y agoNaturally it can be simple, it was already a basic language when compared with what 1960's have produced. The evolution of Bootstrapping CPL compiler + a set of basic types.
- uecker 5y agoThere are plenty of C compilers written in C. Large compiler suites for C/C++ are usually written in C++. But as a contributor to GCC, I can say that large parts of the code still look very much like C.
- pjmlp 5y agoPlenty of compilers... right. If you cannot compile GCC with a C compiler, it isn't C.
- uecker 5y agoThere a couple of open source C compilers TCC, SDCC, tendra, chibicc, ACK, LCC, PCC, etc. and also many commercial ones. It is true that GCC is not written in C anymore, but it is easy to see that the code is still relatively close. I am also myself writing a C compiler in C at the moment and there is no problem at all.
- foxfluff 5y agoI will continue to use C because I haven't seen an appealing alternative.
- phendrenad2 5y agoI'll keep writing things in C, because it maximizes my productivity and gives me extra time to make it secure (less time than it would require to write it in Rust in the first place).