frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Should I choose Ada, SPARK, or Rust over C/C++? (2024)

https://blog.adacore.com/should-i-choose-ada-spark-or-rust-over-c-c
36•1vuio0pswjnm7•2h ago

Comments

phibz•1h ago
If its a personal project then try each and see what you like. Work project then follow your company development guidelines.
jordanb•1h ago
I found that learning Ada was a good way to learn how to write good C++ code, because both languages are at the same level of abstraction but Ada is clean and opinionated.

The best a example is RAII. This is a pattern in C++ that you have to follow if you don't want to make a mess. In Ada it's a language feature called Controlled Types.

6r17•1h ago
Do you feel the same is true for someone who does mainly rust nowadays ? I had the same feeling with rust & python ; If there are any patterns that help in other languages I'd definitely like to look them up
alberth•1h ago
(2024)
mcdonje•1h ago
Even though it's an Ada ad, 'C*/*C++' vs 'Ada*, *SPARK' is wild.
firesteelrain•1h ago
I know there is a belief that Rust/Ada etc is safer than C/C++ and in some cases that is true. I know of multiple, airworthy aircraft that are flying with C++ code. I also know of aircraft flying with Ada. The aircraft flying with Ada is hard to maintain. There is also a mountain of testing that goes into it that is not just unit testing. This mountain of integration, subsystem and system level testing is required regardless
ajxs•34m ago
I've never worked in aerospace, however I'm interested in safety-critical software engineering, and I've written a lot of Ada (and written about my experiences with it too). My understanding is that yes you can write safety-critical code in just about any language, but it's much easier to prove conformance to safety standards (like DO-178C, etc.) in Ada than in C++.

I regularly do hobby bare-metal programming in both Ada and C. I find that Ada helps prevent a lot of the common footguns in C. It's not a silver bullet for software safety, but it definitely helps. The point of any programming language is to make doing the right thing easy, and doing the wrong thing hard. All things considered, I think Ada does a good job of that.

ecshafer•32m ago
It is not saying that it is not possible to make C code that is safe enough to be on an airplane. Its that there are languages with additional features which make it easier to have a high confidence. If you can remove entire classes of bugs automatically, why not do so?
usamoi•1h ago
I've never heard of SPARK. What advantages does it have compared to Lean?
Jtsummers•47m ago
It's basically a subset of Ada, so you can use it anywhere you'd use Ada. I don't think Lean is at a point that it's an Ada replacement.
adastra22•23m ago
Lean the math prover? What does that have to do with Ada/Rust?
Jtsummers•20m ago
> Lean the math prover? What does that have to do with Ada/Rust?

I'm going to be rude, but there are 4 sentences in this thread and you appear to have not read two of them.

The comment I responded to:

>> I've never heard of SPARK. What advantages does it have compared to Lean? [emphasis added]

The "It" in my response refers to SPARK.

lenkite•6m ago
In a project, can you develop one module in Ada and another in SPARK and compile them together ? So, you can use safety-critical code in one module and regular Ada code in other modules ?
jdougan•1h ago
I'm not sure I'd want to limit the selection of languages that much. Depending on the project and how much language risk you can manage (as opposed to security risk), there also is D, Odin, and Zig. And probably a bunch more I'm unfamiliar with.
iknowstuff•23m ago
Zig is not memory safe at all
on_the_train•59m ago
C++ is a good alternative to "C/C++"
crims0n•57m ago
Alternatively, just get better at C/C++… It isn’t going anywhere, and it feels like more developers are coming around to the idea that maybe security guarantees are not worth throwing the baby out with the bath water.
umanwizard•55m ago
It’s a common misconception that the point of Rust is just security. Rust helps avoid a very broad class of bugs, that security bugs are only a subset of.
echelon•8m ago
Google had published a few papers stating that Rust code has fewer defects than similar complexity Go and Java services.

It's not just memory safety, but the design of the type system and error handling semantics that enable it to be smooth with exceptional behavior.

ranger_danger•56m ago
Personally I think Swift can be a good choice that is more familiar to existing C++ developers than the others, and a lot of people seem to be sleeping on it.

It has full native interop with C and C++ so you can already use all your existing libraries. Historically it lacked cross-platform support but this is not true anymore. It does lack a native GUI framework, but for now you can keep using C++ ones.

Some people complain about its ties to Apple, but hopefully with it gaining much wider cross-platform support, it may not matter that much in the future, but I guess it remains to be seen.

aabhay•10m ago
Swift, while being slightly more friendly for extreme beginners than rust, is just so kneecapped and bloated that it has the opposite problem as rust. At some moderate level of competence it actively hinders learning. All of the weird closure and multithreading syntax is more harmful than good. Whereas Rust has a high floor and somewhat infuriating borrow checking, once you figure your way out of them you’ve actually learned a lot about how computers work along the way.
markasoftware•55m ago
Their example of why Ada has better strong typing than Rust is that you can have floats for miles and floats for kilometers and not get them mixed up. News flash, Rust has newtype structs, and you can also do basically the same thing in C++.

I don't know much about Ada. Is its type system any better than Rust's?

forthac•21m ago
This was posted to about a day ago: https://github.com/johnperry-math/AoC2023/blob/master/More_D...

But a noteworthy excerpt: ```

Ada programs tend to define types of the problem to be solved. The compiler then adapts the low-level type to match what is requested. Rust programs tend to rely on low-level types.

That may not be clear, so two examples may help:

    Ada programmers prefer to specify integer types in terms of the ranges of values they may take and/or the precision of floating-point types in terms of digits. I ended up doing this at least once, where on Day 23 I specified a floating-point type in terms of the number of digits it should reproduce accurately: Digits 18. The compiler automatically chose the most appropriate machine type for that.

    Ada arrays don't have to start from 0, nor even do they have to be indexed by integers. An example of this appears below.
By contrast, the Rust programs I've seen tend to specify types in terms of low-level, machine types. Thus, I tried to address the same problem using an f64. In this particular case, there were repercussions, but usually that works fine as long as you know what the machine types can do. You can index Rust types with non-integers, but it takes quite a bit more work than Ada.

```

citbl•13m ago
Yes and no, you need to look deeper into Ada to find that it can have compile time guarantees higher than what you can get from a struct named km and miles.
m00dy•55m ago
yes, you should.
WalterBright•45m ago
Dlang is the GOAT!
xedrac•41m ago
Haha, Walter you're definitely not biased on this one. :)
alberth•45m ago
SPARK is used by NVIDIA for the most secure compute code.

https://www.adacore.com/nvidia

Show HN: Soravideodownloader.com – A tool to save Sora videos and prompts

https://soravideodownloader.com
1•czmilo•4m ago•0 comments

Find Nearby Automated License Plate Readers (ALPR)

https://deflock.me/
2•walterbell•5m ago•0 comments

VC Dogmas in AI That Don't Matter When You're Bootstrapped

https://threadreaderapp.com/thread/1975042988637372597.html
1•fullstacktard•6m ago•0 comments

The true cost of cyber hacking on businesses

https://www.bbc.com/news/articles/c5ye8zj5l4jo
1•wahvinci•8m ago•0 comments

The Server in the Closet

https://robertgreiner.com/the-server-in-the-closet/
3•freediver•13m ago•0 comments

Vibe Coding Breakpoints: Where No-Code Projects Break – and How to Build Smarter

https://pawgrammer.com/blog/vibe-coding-breakpoints
1•royaldependent•13m ago•0 comments

Tsujigiri

https://en.wikipedia.org/wiki/Tsujigiri
2•ikeashark•30m ago•0 comments

Why We Need SIMD

https://parallelprogrammer.substack.com/p/why-we-need-simd-the-real-reason
2•atan2•37m ago•0 comments

Hopefully the Most Gentle Introduction to Simulation

https://rishit-dagli.github.io/2025/09/27/simulation.html
3•dagli•48m ago•0 comments

Building Effective Text-to-3D AI Agents: A Hybrid Architecture Approach

https://www.addy.rocks/blog/text-to-3d-agent-hybrid-architecture
2•addy999•50m ago•0 comments

Bird Photographer of the Year Gives a Lesson in Planning and Patience

https://www.thisiscolossal.com/2025/09/2025-bird-photographer-of-the-year-contest/
1•surprisetalk•54m ago•0 comments

Brr: An Antarctica Blog

https://brr.fyi/
2•surprisetalk•54m ago•0 comments

The Integral Guide to Well-Being

https://integralguide.com
3•surprisetalk•55m ago•0 comments

Mesa Project Adds Code Comprehension Requirement After AI Slop Incident

https://hackaday.com/2025/10/01/mesa-project-adds-code-comprehension-requirement-after-ai-slop-in...
2•gpi•57m ago•0 comments

Illinois Utility Pilots Vehicle-to-Grid Program With Electric School Buses

https://insideclimatenews.org/news/03102025/illinois-electric-school-bus-vehicle-to-grid-program/
2•sipofwater•58m ago•0 comments

Powerful Cartels Are Building a Gold Mining Empire [video]

https://www.youtube.com/watch?v=8GwSqRccvmc
2•johntfella•1h ago•0 comments

AgentCursor – Make the browser automation scripts move the cursor like a human

https://rajasekarm.github.io/agent-cursor/
3•rajasekarm•1h ago•1 comments

Programming in Assembly without an Operating System [video]

https://www.youtube.com/watch?v=ZFHnbozz7b4
1•sras-me•1h ago•0 comments

Between 1875 and 1925, 80k tigers were killed in India under British rule

https://old.reddit.com/r/IndianHistory/comments/1nir430/between_1875_and_1925_over_80000_tigers_w...
4•haltingproblem•1h ago•0 comments

Releasing New Chat System

https://emotion.vision
1•New-project•1h ago•0 comments

Reaction Time Test

https://reaction-time-test.org/
1•Ante_max•1h ago•0 comments

Memory Tagging Explained: Why the iPhone 17 Is a Cybersecurity Game-Changer [video]

https://www.youtube.com/watch?v=5McB6-2r-ds
1•kkin1995•1h ago•0 comments

Revocation Confusion

https://nullpxl.com/post/revocation-confusion/
7•nullpxl•1h ago•2 comments

I Miss Web 2.0

5•geuis•1h ago•0 comments

The Open Source macOS Window Manager app, MacsyZones 1.9 is released

https://macsyzones.com/?v1.9
2•rohanrhu•1h ago•1 comments

'Determination and ingenuity': Australia's oldest man just turned 112

https://www.sbs.com.au/news/article/australias-oldest-man-celebrates-life/p7v9yud7i
2•defrost•1h ago•0 comments

Embracing the parallel coding agent lifestyle

https://simonwillison.net/2025/Oct/5/parallel-coding-agents/
2•Anon84•1h ago•0 comments

Embracing the parallel coding agent lifestyle

https://simonw.substack.com/p/embracing-the-parallel-coding-agent
1•waprin•1h ago•0 comments

Why do LLMs freak out over the seahorse emoji?

https://vgel.me/posts/seahorse/
36•nyxt•1h ago•1 comments

MODPOD: The collapse of IETF's protections for dissent

https://blog.cr.yp.to/20251005-modpod.html
3•zdw•1h ago•0 comments