257 points · by q-big · 4y ago · 362 comments
For whatever reason with C there’s this huge emotional component to it. Safer alternatives exist. You’d rightfully laugh at a contractor who suggested asbestos is fine, if you make sure to use only highly-skilled installers who patch up the drywall so that no fibers can escape. But with C we say that all the time, and the CVEs keep piling up.
Frankly getting your knickers in a knot is emotional - the people using C are doing so for pragmatic reasons, not emotion.
I do see comments like yours a lot - there's an emotional attachment and/or ego attached to the comment, so the argument against is very vociferous and, honestly, ugly[1].
[1] C and asbestos have almost nothing in common in terms of negative impact on the world. Maybe people are still using C because hyperbole is simply not a persuasive argument.
Could you explain how it's emotional? It comes across as a pretty logical analogy to me - the author isn't suggesting that they don't like C (which would be categorically emotional), they are comparing it to phasing out something unsafe in another industry.
You call it a logical analogy, how an analogy can be logical?
EDIT: and I hate analogies because, since they suck, someone will try to come up with a better analogy. And now we have a thread where people compare C to asbestos, then they compare C to a fire in kitchen. Not a kind of thread I would like to be in.
Everyone would be better served by using and hearing it less. Focus on the actual argument.
1. "Don't rewrite code" a fundamental precept of software that has been "engineered"
- This is more about development lifecycles than something that contributes usefully to software quality in the long term. Corporations, and people haven't been treating these things like bridges or overpasses
2. Outsourcing is believed cheaper than the solution. - Again, paying low-wage junior SEs to patch uncovered bugs is obviously cheaper than proactively finding them all.
3. You can sell the New Coke too! - If you have a good rewrite, sell it at a fat markup, and keep selling the old crap too, it's not your risk.
- Obviously don't rewrite unless your horrid monolithic source leaks, and you're certain that it's a problem, those disgruntled workers you wrongfully laid off know too much.
4. If your tech references are a security risk, sell those too! - Don't include pesky manuals where people can uncover issues with your development processes, outsource a minimum blackbox of guess work to Singapore and let that double as QA.
- It's not a manual, it's 'training' -- supporting education of hopeful workers! Wow!
I won't name any names.I think a lot of us using C would like to move away, but for whatever reason can’t. One example is that we hotpatch our binaries, but that sort of infrastructure doesn’t exist for Rust.
Beyond tooling issues, that certainly can be fixed, it’s also non trivial to move a large codebase to a safer language. Maybe incremental use of languages like Rust is still better?
We still have software running in excel macros that control web browsers via COM. C is nothing compared to the attack surface of that.
Even the analogy holds up in this regard: using other materials instead of asbestos does not remove all the construction problems.
I think C has other things going for it (simplicity of the compiler), just wanted to point that out.
According to studies done at Google and Microsoft, about 70% of their serious security issues are a result of memory safety errors.
>Around 70 percent of all the vulnerabilities in Microsoft products addressed through a security update each year are memory safety issues; a Microsoft engineer revealed last week at a security conference.
https://www.zdnet.com/article/microsoft-70-percent-of-all-se...
and
>Nearly 70% of the high severity security bugs in Chrome's code are memory unsafety problems, Google's engineers have revealed.
https://tech.hindustantimes.com/tech/news/70-of-security-bug...
And in discussions like this, it's verging on the dishonest - leading with a large number makes readers think that a large difference to bug count will result.
> Around 70 percent of all the vulnerabilities in Microsoft products addressed through a security update each year are memory safety issues; a Microsoft engineer revealed last week at a security conference.
What's the total bug count?
A codebase with 10000 bugs logged against it might have maybe 10[1] that are CVEs, of which, according to that statistic, only 7 would be fixed by moving to a safer language (either GC or Rust or similar).
That's just not enough motivation for switching when the payoff for preventing "70% of CVEs" is so small it may never even happen.
[1] I've worked on C codebases that were developed over a decade, and 1000:1 of all-bugs:memory-safety-bugs is a very conservative ratio. IME, it's been closer to 10000:1.
Getting rid of a class of errors (correctness) allows you to focus more on other errors (logical). It could be argued that it could slightly reduce the likelihood of the latter.
"It will solve memory leaks!"
...
"whoops, you can still leak memory in garbage collected languages, my bad everyone!".
I think you mean "memory safety", not "correctness".
Correctness is a much harder target to hit and requires a good deal of time.
Moreover, almost no bugs are discovered in the actual reasonable software we have. That's not because we are the best engineers, or because we write it with the utmost care and attention to detail. It's because we're a total of 5 people (mostly a couple of years out of uni) looking at it. C, and other systems programming languages are greatly overrepresented in the corpus of software that is actually being combed through for bugs. Java and Cobol are heavily underrepresented.
I want to make this clear again. I work in banking. If 2008 showed us anything it's that banking underpins most of our modern society so these quality issues are not unimportant, they can be devastating.
What people do believe is it would remove whole classes of security problems that affect everybody. Even if you have software running in excel macros. Maybe in your environment that is a minority of your problems. That is probably not a good thing, and we feel for you, and respect preferring to tackle that problem first. But it would be a good idea to not entrench C further while you are doing that. Once you shrink your attack surface, it would be great if the code being invoked doesn't have exploitable memory overflows to make all your hard work pointless.
And that's all working as designed. Someone built it like that. There's no bug anywhere in that chain, just as extremely rickety system with no affordances for human intervention. No separation of what is trusted and what is not.
There's a good case to be made for using better languages than C and C++ for large classes of software. Don't weaken it by making absurd claims.
We stopped using asbestos because of the link between its manufacture/installation and lung cancer. It’s a clear case where government regulation helps deal with a market failure: asbestos is cheap and effective, so consumers like it, but nobody involved in asbestos transactions bears the cost of the lung cancers the industry causes.
Writing C doesn’t make underpaid programmer die early deaths. The issues with C are borne directly by the customers who are using C software. It’s not really a market failure of any kind.
While I agree that equating a programming language to a carcinogenic substance is inherently wrong, your argument is partially false too.
The cost is born by the costumers of the software, not the developers. In that sense, it's actually directly opposed to your point.
I work with C and it kills me a little more each day, just like cigarettes. Its a pretty fair comparison.
And really, I think your argument bolsters my case. Federal and state governments are freaking out about cybersecurity and protecting infrastructure and voting systems, so why shouldn’t they ban the use of software written in C in their acquisition process?
Unlike asbestos insulation in houses, or flame in your personal kitchen, you actually can't avoid C in your software stack. Do you use Linux, FreeBSD, or OpenBSD, or macOS, or Windows? Do you use Postgres or MySql or sqlite, or maybe redis or memcached? How about a language like Python or JS or Java or Ruby or Lua? Do you use rust? guess what the business-end of that compiler is written in! so you dabble at the tippy-top of the stack in some language like rust or go, so what?
You know what, construction industry could have made the same argument - oh look, all insulation suppliers use asbestos, the factory is built out of it too, its everywhere in the supply chain, you can't actually avoid asbestos if you ate trying to build a house, so we should learn to live with it.
You can't avoid fossil fuels, you gave to use fossil fuels to produce a solar panel, so dreaming about clean energy is pointless.
The difference is that some i industries pull the finger out of their bum and clean up their act, and some i dustries, like our's, does not. Even thoigh perfectly serviceable alternatives exist.
But really Rust seems to have the qualities I like about C and less problems. Also, all the reasons I used to have for wanting to be "close to the metal" are getting abstracted away in hardware. I think the only remaining reasons to use C is the huge existing code base.
> ...the complexity of C / C++
In this case, please don't throw C and C++ into the same bucket, C++ is vastly more complex than C.
> Rust seems to have the qualities I like about C
...a subset of Rust has those qualities, but the whole of Rust has the same problems as C++: overboarding complexity both in the language and stdlib.
To lure C users over to a memory-safe language, we need a programming language that just adds the comptime memory-safety features to a 'small language' like C, but none of the higher level features (which only serve to split the language community into different tribes - which is also the biggest problem of C++).
Finally: yes, C is not memory safe, but when 'language-level memory safety' is essential for security, then there's something fundamentally wrong with the sandbox the compiled C code runs in.
Doesn’t the problem then just become what do you write the sandbox in? If you have security-critical code that can’t be sandboxed, because it is the sandbox, then it seems that language-level safety is your only remaining defense?
You probably get accustomed to it, but I am not sure if I want to yet. Not deep enough into compilers to know why variables cannot be implicitly mutable or not. Probably a compiler necessity to enact its borrowing rules. But ultimately the compiler should make my life easier. Only ever using one thread or process does solve several common locking issues.
In that regard C string handling will probably let more people move away from it than its security flaws.
It will probably end up like always. There are some applications where some languages shine. And the simplicity of C has merits, otherwise another language would have taken its place. Of course C still has a lot of momentum and perhaps another language would do better in the specific use case.
For a lot of things, I just don't think this is true.
For example, here is sqlite's reasoning for choosing C: https://www.sqlite.org/whyc.html
I can't say I can really disagree with it.
“I don’t need seatbelts, I actually know how to drive unlike others”
Unfortunately, a lot more switching cost is involved in getting embedded and systems programmers and platforms over to a new programming language, than is involved in getting construction contractors and industrial engineers to choose a different material.
And c like language on these embedded devices are probably due to the fact that it's the easiest way to implement a programming language(abstraction) that work on bare metal.
That's the exact problem with C. It's the tool, not the attitude, which is a problem.
Language-level memory safety is useful for eliminating an important class of bugs, but if those bugs can be exploited to escape the sandbox, then that's the problem of the sandbox, not of the buggy program running in that sandbox. So please, by all means, write the sandbox itself in a memory safe language like Rust, but requiring the same for all code running inside the sandbox is nothing more than an admission of failure.
Using nuclear power correctly takes a ton of engineering prowess, lots of additional construction. If done well, it works great. When it goes bad, it goes really bad.
So if it's 1982, maybe nuclear power or C is a good option. If it's 2022, new technology may provide a cheaper way of getting to the same end point, with less engineering and construction, and probably even less cost.
Why would your experience there make you think the good nuclear plants are any different?
So this doesn't actually affect things built on top of C. E.g. transpiling Rust to C won't make it any less safe because C is "unsafe" - Rust has its own safety features, that work regardless of compile target.
Or think of it this way - assembly language is even more unsafe than C, yet everything (including C) is built on top of that.
C is safe if you are using a 1970s-style compilers that don't perform optimizations, or perform a limited and predictable subset. C that is passed through an optimizing compiler (which in the context of this comment is all modern compilers) can never be inherently safe unless you conform strictly to the "undefined behavior" spec which is impossible in practice.
In contrast transpiling (really this is just compiling) Rust to assembly should never be unsafe, because you know there is no additional transformation step. Or at least, unless the processor has an implementation flaw... which is, of course, the whole thing about Spectre/Meltdown.
C has far far too many things in the "unsafe behavior" categories that really should just be compiler errors. But like "implementation-dependent" behavior in general, this was seen as an advantage at the time, it makes it possible for low-power or esoteric hardware to be driven with C code. But in modern high-level software development contexts, this makes it a foot-howitzer to try and use.
(at least that is how I know it as)
C is not "unsafe" in the sense that little bits of it break off in installations and make people sick, but in the sense that the assurance of safety almost all rests on the programmer.
If code is safe, and not changed, it stays that way.
Sure, but do they have certified compilers for Functional Safety (ISO26262) development for Automotive or Medical applications? Rust does not, although there's a company working on it.
Other languages make me depressive and steal my focus. They make me go to great lengths trying to get the simplest things done. In C, it's like memset(p, 0, sizeof *p), done. Other languages make it such that I always code on 3 layers of abstraction to not have to do the "hard" task, but now I don't know the implementation of those layers. They make it such that I'm constantly torn to come up with an even more clever thing to say the same things, with even more abstractions and moving parts. They pull so much attention to themselves, distracting from the task that I want get done. With C, this is not the case.
Maybe with a different personality, I could be similarly or even more productive in Rust, ignoring all the kitsch in its ecosystem. But I've started reading Rust projects dozens of times and have always turned away. They always use one more abstraction than I can be arsed to look up, always hide the most interesting and motivating parts behind a crate dependency.
This is not the case with C, where it is easy to find good (enough) code that is honest and direct, and rewarding. I know that C is not perfect. We're having an open relationship, and I don't have any attachments (besides knowing it well) that prevent me from jumping ship when I find a better one.
But, it isn't used in products designed for the general public where strict oversight can't generally be provided.
We use incredibly dangerous materials in photolithography, nuclear weapons production, armor piercing projectiles, and aerospace... because there are no alternatives and/or the benefits outweigh the risks.
What changed is that we learned more about asbestos (it causes cancer) and phased it out of applications where alternatives existed, even more expensive ones.
In the C analogy, there may be places C continues to make sense... but it shouldn't be used anymore out of default, because it's the way things have always been done, or any other reason that doesn't end with "... and that's more important than an increased risk of security vulnerabilities."
Do they? The only “safe” comparable alternative is unsafe Rust which as the name suggests isn’t actually safe.
This guy is just doing the typical religious yelling about people doing their jobs (writing kernels, drivers, browsers, games, etc) with the most flexible tool for programming we've developed to date.
Maybe one day Rust will become dominant. Maybe someone will overhaul the aliasing rules of C, write some similar lifetime tracking tooling, and it will live on for another 50 years. Who knows. The reason people still use C and C++ isn't because they're good languages (or even that people like them, as the comment states), it's that until recently there have been very few viable alternatives, and for some domains literally none at all. They've largely been the only option for a long time.
And for some applications, Rust isn't even an alternative. Not every chip is supported by LLVM.
Their use combines the proper use of C (low-level driver code) with the unsafe use (large-scale systems). They should absolutely stop using C. On the other hand, I think it's fine for my network driver.
Maybe that speaks to some of the driver problems they're having now, if their house just wasn't in order beforehand.
This will not be a quick change. C is interoperable, and the industry is moving slowly.
It's also wrong. A lot of the time the people making these types of comments about C are just plain bitter that their favourite $NEW_LANGUAGE is mostly a rounding error in terms of usage.
But the message overall - that maybe we don’t need to instinctively reach for C for newbuild low-level programming anymore - is probably about right
Like, everyone knows typescript catches more human mistake that JavaScript. But you won't know why if you don't know JavaScript at first place.
If there's a joke here I missed it, sorry.
Having said that, I would never recommend C as the language of choice for new projects.
i adore C, it was my first language and i still like its simplicity very much. Still, I have come to believe that only strictly vetted licensed people should be allowed to use it :)
A lot of memory safety CVEs come down to "we wrote a static analyzer and found a latent memory bug here."
No need to talk in past tense. C is still the best language at what it is meant for: writing fast software. Not safe software, _fast and portable_ software.
> but the safety problems outweigh them
Safety is to speed what security is to convenience. Frankly, most of the arguments I see today are just fear mongering. In my experience, there is no protecting users from developer mistakes that lead to software exploitation and 'unsafety', independent of the language being used. Memory issues are a common avenue, but if you take it away, the next issue will become the main avenue for exploitation, and you'll be back in the same spot, with the next generation of developers fearing that the new software safety level is insufficient to reach some ideal safety level, all while having traded off real world speed across the board to reach that point.
> no new installations use it
I'm writing a tool in C. It doesn't need to be perfectly secure. It does need to be fast.
By using C we acknowledge that users want speed, more than they want safety, and that's our developer reality. That doesn't mean users don't want safety, it just means that outside of specialized domains, on average speed takes priority - people have been voting for decades that they want speed more than safety, and the process of deciding the priority is as you'd expect: users use money to buy a faster product and companies selling software invest in making their software fast first.
The security argument is also weak. The whole point of cracking software is to find flaws in existing systems, regardless of the language they were coded in. One thing will always be true: anything that sends data can be cracked. You can only make the entry bar harder, but you will not create a language that is significantly safer and as fast as C because the optimizations that make software fast (like not checking array lengths, not checking for overflow, etc) are also the ones making it less secure.
One can create a language that's safer than C and fast (in specific situations), but there will always be people cracking the core of whatever the 'safe' language du jour is, so you will have decreased security incidents on average, but have not eliminated them, while leaving room for a competitor to swoop in with a faster product that's safe enough, and it's your users who will decide who wins, not you.
Just to emphasize this, so far, I have not seen any indication that the general population will shift to picking safety over speed, so you'd be betting against your users.
1. consistently had much faster compilation times than C++ or Rust
2. consistently generated some the smallest binaries
3. consistently ended up in #1 on programming language benchmarks
4. consistently been used to write the worlds OS kernels, where speed is critical
does not have _strong evidence_ that is going to continue to deliver better performance than C++ or Rust?
On the contrary, there is no evidence that Rust will ever be as fast as C. The burden on proof is on you and Rust to support your bold claims. C++ is in a different boat - it already tried to displace C in the 90s and it has been successful only in the environments where its other properties are a much more needed advantage, not for being faster than C. That's where Rust will end up - in between Java and C++. It will never displace C, because you pay for runtime safety with CPU cycles. Static analysis can only get you so far.
Even Java's JIT, which got everyone excited about beating C in the early 2000s, failed miraculously at being faster than C, even if it could generate better assembly code at runtime, precisely because extra features cost cycles which necessarily slow down execution speed, so you're not the first group of people with starry eyes and bold claims about performance and C.
As far as the generic simd hashmap goes, it will always be slower than a specialized custom built hashmap in C, even if it takes longer to code it and has more bugs.
I know the approach is not the same, but the goals are similar enough. And I think that Ada core principles are more useful and less "magical" for hardening code.
Otherwise, I agree. Ada is pretty great. It deserves more love.
The original "Rationale for the Ada programming language" book provides a lengthier discussion on these points.
TLDR; The syntax is an intentional language design choice which puts capture of design intent in the forefront over implementation details.
A := B;
X := Y(Z);
Is B a variable name or a function call? Is Y a function or an array? Is Z itself a function call? There is no way to know the answers without looking up the definitions for B, Y, and Z. And the answers are important because function calls can alter the program state and affect performance in ways that a variable deference or array subscript cannot.So when reading Ada code, a developer has to constantly jump around the code base to understand which fundamental language mechanics are being used. It's a frustrating problem for someone who has to review real-time, safety-critical Ada code. And I've never run into that problem with any other language.
Perhaps, like any other tool-set... C has an optimal problem domain not everyone can understand, and it is often unrelated to llvm compilers.
Those who failed to learn why C++ evolved into its current state, are simply doomed to naively make another iteration of the same tantalizing bad design choices.
The fundamental theorem of software engineering (FTSE) is a term originated by Andrew Koenig to describe a remark by Butler Lampson attributed to David J. Wheeler:
"We can solve any problem by introducing an extra level of indirection."
The theorem is often expanded by the humorous clause "…except for the problem of too many levels of indirection," referring to the fact that too many abstractions may create intrinsic complexity issues of their own.
https://en.wikipedia.org/wiki/Fundamental_theorem_of_softwar...Think of all the layers of abstraction that have led to this moment, you reading this comment, me writing it: the hardware, the operating systems, libraries, run-times, the network... it's immense. And it's a wonder that it works so well let alone at all.
I like this quote but I think it applies to weak abstractions; ie: not abstractions at all but, as they say, indirection and obfuscation. Using the word "abstraction" has done a lot of harm to efforts to convey the importance and utility of various formal methods from property testing to proof automation. A solid abstraction has fundamental laws and properties. It aids in mastering complexity rather than hinders.
It's worth keeping in mind that this isn't a fundamental law of the Universe. Not all abstraction layers are equally good. Just because it's possible to do a bad job at something doesn't mean we can't try and do a good job.
;)
Isn't this what neural nets are solving, right now? ;)
This system is still sold nowadays as Unisys ClearPath MCP.
I'm not necessarily saying it's a good language, but it's an excellent abstract machine. It won't die.
I'd prefer a clear 1 liner in Julia or Prolog over 80 pages of unknown correctness. ;)
C project Version: 2.5MB, 6 dependencies, and uptime 3+ years (OpenSSL patch ended the streak.)
Being busy is not necessarily productive, and "Better" is often use-case dependent. =)
I have 10+ year Perl app that never needed fixing but I don't present it as an example of Perl being better than everything.
Also JS is a particularly bad language in near-every respect and not even in same category as C so I dunno why you compare them in the first place.
How fast can you add features to both?
How easy it is to find developers for both?
Anyway, you are really claiming that a sandbox capable of running C programs will solve more problems than writing your code in Rust?
Its not a complete waste of time, but I have yet to see a use-case only Rust features could better achieve. I am not smart, so may have missed something important. =)
Hum... If you know other languages similar to Rust, I'm curious to know them. Maybe there is something better out there, but AFAIK, the closest thing in existence is C.
> a different problem domain already addressed in higher level languages
Things like device drivers and embedded software. It's also what people push into submission when they want high performance software, but this is always a hard thing to do.
I do really not recommend you to use Rust if a higher level language solves your problem.
> I have yet to see a use-case only Rust features could better achieve
It helps achieving things like making sure your GPU driver fucking works, instead of doing what the nvidia driver does.
Of course, this article is about a different way of making sure it works. One that requires a lot more of work, but can provide some assurances that Rust can't. It is also easier to apply over Rust than C, but neither are the best target for it.
Programmer as user just makes sense once you've moved past punch cards to interactive IDEs. Everyone should have stopped using punch cards by now, but lo-and-behold this is still basically the standard in some outfits.
One can never assume our use-case assumptions will generalize. =)
... that step wouldn't constitute introducing an abstraction either.
Maybe this is true specifically for C. However you imply this is true for "any other tool-set".
This is also a form of bias. It is illogical and irrational to think that every tool set is good for something. Things that exist can be horribly bad for everything and things that exist can in theory be good for almost anything.
There is not magical rule that says all tool-sets are great because they're always optimal for some niche problem domain.
The universe is not made up of apples and oranges. There are rotten oranges and rotten apples as well.
There are often language specific features that are not isomorphic, and are the primary reason a language was developed in the first place. =)
You have a problem: You need to eat soup and steak. So you use a spoon or a fork. The lump of coal is useless. You can probably smash the steak with it then eat the remains or lick the soup off the wet coal you dipped into it. Possible but a horrible tool overall.
There is an argument to be made whether certain languages are lumps of coals rather then a spoon or a fork =).
https://web.archive.org/web/20221107153324/https://releases....
https://releases.wekan.team/ada/222559-adacore-nvidia-case-s...
Personally I think “what if we stopped using npm?” and “what if we stopped using cargo?” are much better security questions to be asking at this point.
Security teams today: Hey, why are you using that language?
"Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980, language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law."
Humans are not good at programming. I've never seen a "done" C++ codebase in my life, maintainers are always too busy reinventing parts that had originally nothing to do with the feature scope of their library.
No reason to limit to "C++" there. It's an industry wide problem with every language. Even in open source, if a repo hasn't had commits in the last week, most people treat it as a dead project.
By "most people", you mean GitHub-era folks who are secretly more interested in the things about the site that fulfill their social needs than they are interested in solving the problem that the software is supposed to be used for.
It does not sounds like ad, but like Fortran. Last Ada job I remember was mars rover in 90ties. Great but nothing for new hires!
Ada is more memory safe than rust technically, although with less devs using it.
Ada compilers never used GC, and it was eventually dropped from the standard.
Since Ada 95, that RAII is supported via controlled types.
Additionally in many cases like strings and vectors, the compiler does the memory managment for us anyway.
Ada doesn’t use allocation, remaining 100% memory safe.
Most of those can be disabled though through the 'restriction' mechanism (look up Pragma Restriction which is very interesting in itself).
SPARK itself can handle and prove some ownership properties but to the best of my knowledge isn't at the level of rust in memory safety on dynamically allocated memory.
I don't believe it's possible to cause unsafety using Arc in safe Rust. I don't know what "reference count incorrectly" means here. Could you explain?
If language A is "better" but language B has all the libraries and developers, the right choice is usually still B.
I am impressed by the Swift language: nice REPL based development if you want that, typed, great support for Apple devices and some support for Linux.
I feel like you can’t put Swift in the world of Rust/Ada/C/C++
Here enjoy a full graphical workstation OS developed at Xerox PARC, Mesa/Cedar uses reference counting with a cycle collector.
Reference counting leads to memory leaks if cycles occur. Garbage collection algorithms don't have this problem.
> REPL based
What?
But another huge issue is that C is the language used by the OS. If you want to use that OS functionality to allocate memory, do networking, IPC etc, you are using a C header file and calling into it. We had a binding library to making calling C from Ada easier, but its still an extra step. The good news is that other languages are starting to have some great libraries.
Ada and Rust and a bunch of other languages are safer than C, and likely a better choice. Its just there is a lot of existing code to port over.
“C is the only good language. And you should use it for everything.”
“Even web servers that power apps?”
“How could you consider anything else?”
During the same program (over ten years ago), someone came from Adobe and basically said “C/C++ are the source of the majority of our security bugs and would just go away with another language.”
Change is hard folks
You can cook your own (C++, WASM and Java), but if it was standardized and cross compatible.
Also curious why so many dislike streams?
Golang is basically C with pointers, and still very very static in its programming paradigms.
Were you referring to unsafe pointers and calls to Cgo?
But as far as I understand golang's memory internals, they still offer you to use the copy-based stack directly ("var some SomeStruct;") or to allocate things directly on the heap (via "new(SomeStruct) / make(SomeStruct)".
I might be wrong about this, but this is what I understood from casually reading the spec [1]; while they never mention stack or heap specifically and describe it more as memory being allocated at run time, which kind of hints to a copying garbage collector underneath. But they also seem to implement a mark and sweep mechanism [2] so I'd say it's a hybrid GC, similar to how ECMAScript VMs work these days.
Nevertheless you're right with the argument that it doesn't offer a way to manage memory yourself, which I think is a good thing. Technically you could use "C.malloc()" and "C.free()" though.
> Were you referring to unsafe pointers and calls to Cgo?
Yeah, I was kind of referring to the possibility to implement C-interface adapters using CGO (the internal "C" and "unsafe" packages). Personally I would only use C APIs if there's no way around them, though, and keep as much code in golang as possible.
[1] https://go.dev/ref/spec#Allocation
[2] https://github.com/golang/go/blob/master/src/runtime/mgc.go#...
It'd be really nice to be able to trigger some scope-exit behavior, too, IMO.
I think I'm not going to like it because I want something that is foundational = works everywhere, is stable everywhere and has all features everywhere (f.ex linux 32-bit on ARM)
But I will give it a fair shoot.
"Welp, back to C because AMD's performance is overtaking ours."
https://www.reddit.com/r/Amd/comments/xvtn2u/amd_your_driver...
Truth is to have good drivers you need a lot of people and $$$, Nvidia has the upper hand on that.
In daily usage, I think I've found one issue with the AMD card, and a couple with the Nvidia card. What's worrying is that when filing bugs while using an Nvidia card, devs both times gave the pseudo-automated answer "we can't solve that, Nvidia drivers are closed source", which was wrong in one case.
In Windows, I've used all the cards for gaming only, and never had any issues.
https://www.slideshare.net/AdaCore/securing-the-future-of-sa...
As is making assumptious comment without reading the article, especially when the comment may be wrong. I think it's not only unhelpful, but actually harmful, because other people, who also jump straight to comment section, may form an opinion based on misinformation. Also, timbit42 did provide us with what they read in the linked content; unless they added it with an edit.
And if they need help accessing it, help can be arranged.
† No Gandhi: https://quoteinvestigator.com/2017/10/23/be-change/
> In conclusion, Mohandas Gandhi did write a pertinent passage in 1913 that expressed a similar idea, but the popular modern saying is considerably more concise and forceful. QI believes Arleen Lorrance should receive credit for the expression she wrote in 1974.
I assumed they were switching to Rust, but that doesn't seem to be the case.
Similar technology exists for Rust, but it is much less advanced than SPARK is (https://github.com/xldenis/creusot)
> it is possible to prove mathematically that your code behaves in precise accordance with its specification
So that bridges from one thing to another; but what prevents flaws in the specification itself? Is it just simpler/easier to read than the code is, so they're easier to spot?
Kind of. You basically annotate your program with pre/post-conditions, then you run the program through a theorem prover, which attempts to prove all of your conditions are true in all cases.
The basic guarantee is that if you pass the theorem prover, your code will be free of array out-of-bounds accesses, null pointer dereferences, integer overflow, divide by zero, and other runtime errors. These are useful security properties to prove always hold, and you don’t have to explicitly write specifications for them (just conditions to help the prover along).
If you want to go further (prove functional correctness of your program), you can add more specifications. A lot of times you just want to prove some basic sanity checks hold 100% of the time (e.g. always return a sorted array). These can be pretty easy to specify correctly.
"What if you used static analyzers to detect these issues before shipping?"
"What if you put bounds checking into your functions to prevent this?"
"What if you tested your software more effectively before shipping it?"
This is a popular but useless question. The reality is that to err is human. At scale it's even worse because now you're not just accepting that you personally may be capable of mistakes when writing software, you might have made a mistake when hiring the people who in turn hire the programmers. Ouch.
> What if you used static analyzers to detect these issues before shipping?
In principle all the modern safer languages are in some sense is more static analysis. But the analysis is made possible in considerable measure through language design. If you insist on an unsafe language (like C or C++) then the analyser can't help much beyond "Don't use this language". Good advice.
> What if you put bounds checking into your functions to prevent this?
Bounds checks are a very small part of the problem. They're symptomatic (a language designed to do well at this will enforce bounds by one means or another) but not sufficient.
> What if you tested your software more effectively before shipping it?
You can't afford to actually test software thoroughly by its nature. You will only be able to test a microscopic fraction of possible system states, whether the softwawre works as intended under all the many other states remains unknown.
See? but have you measured it?
> CPUs are now 1GHz
> C is obsoleted outside small sections of code such as image processing
> 23 years later
> "What if we just stopped using C?"
Something I suspect they focus on here is the boot ROM or the SEP RtOS, which is small enough to warrant this kind of scrutiny.
Internet toxicity can entirely suck the fun out of participating in a community, thereby defeating the purpose of participating in it.
But, similarly, a really fun community can do the opposite. I used to participate in the Ruby community more for the people than anything else. I never actually loved the language all that much.
A) What makes you think it's a teenager? The internet makes even ordinary people act in ways they would not act IRL.
B) It's completely reasonable to avoid something because you don't like the community. Comments like the quoted one in GP post are definitely not rare from the Rust community.
the rust community can deal with caustic advocacy or they can do nothing. they've chosen to do nothing, from what I can tell.
accordingly, I've chosen to stay away from that product and its community.
this is not a crackpot point of view, this is the point of view of a sane person who realizes that his time on earth is finite and who has zero appetite for games.
This is just how tech works and how tech people tend to behave.
Yes, absolutely.
> This is just how tech works and how tech people tend to behave.
I really think that that this old guard mentality needs to die out. Rudeness is protected in the industry because we normalize that it's... what, intrinsic to programming? But that just isn't true, and it's harmful to everyone in the field.
Back in the day, yes, the Linux community was indeed quite bothersome. That's why I fairly quickly switched to FreeBSD as my primary OS. I found I had a lot fewer toxic interactions in the FreeBSD community than I did the Linux one. In time, FreeBSD didn't really cut it for me any more, so I switched to OS X. The Mac community does have its incorrigible elements, too, but they are much easier to avoid than they are with Linux, where interacting with the community is a must in order to get help.
Yes, these things do have implications for open source communities. Personally, I suspect that, all along, the biggest headwind for Linux on the desktop has actually been that the social environment surrounding Linux tends to alienate people who might otherwise have stuck around to help make it more successful.
Rust is already 12 years old.
feverish advocates detract from the thing they aim to augment, and yeah, the worst thing about anything on the internet is its community, by a wide margin.
I’m not going to be importing all of Rust to tinker on an RPi.
What if we accepted that not everyone is working on big tech corp problems?
Edit: https://web.archive.org/web/20221107114522/https://blog.adac...