News for hackers. Stuff that matters.
Re:Ada for the C++ and Java Developer [pdf] by MaxBarraclough on Sunday March 28, 2021 @09:17AM (#26610093)
I didn't mean pointers/access-types, I meant ordinary integer-type locals.
Re:Ada for the C++ and Java Developer [pdf] by pjmlp on Sunday March 28, 2021 @09:30AM (#26610216)
You can put a pragma Warning_As_Error ("never assigned"); or the respective compiler switch on GNAT.

Other compilers have similar switch.

Heck even C and C++ have them, although few make use of them.

Re:Ada for the C++ and Java Developer [pdf] by MaxBarraclough on Sunday March 28, 2021 @10:29AM (#26610678)
Also, I think Ada is fully memory-safe but for initialization. That is to say, the only way in which it's not memory-safe, is regarding uninitialized variables. (That's assuming of course that you don't disable checks.)

I'm not sure if it lets you shoot yourself in the foot regarding invalid type conversions, misuse of unions, that kind of thing.

Re:Ada for the C++ and Java Developer [pdf] by okl on Sunday March 28, 2021 @11:22AM (#26611112)
Re:Ada for the C++ and Java Developer [pdf] by touisteur on Sunday March 28, 2021 @09:47AM (#26610362)
Pragma Initialize_scalars for the win. But at runtime.

And if you can afford it, Codepeer (static analysis) finds most of the ones the compiler doesn't find. And then if you can live with the Spark subset, you get proof of initialization in 'bronze' mode :-).