3 ms·
Bitfields are integrated in Ada and created through representation clauses : http://sworthodoxy.blogspot.com/2014/03/ada-vs-c-bit-fields.html http://sworthodoxy
by touisteur 8y ago
Bitfields are integrated in Ada and created through representation clauses : http://sworthodoxy.blogspot.com/2014/03/ada-vs-c-bit-fields.html http://sworthodoxy.blogspot.com/2014/03/ada-vs-c-bit-fields....
You can also set the endianness (bit and byte order) : https://www.adacore.com/gems/gem-140-bridging-the-endianness-gap https://www.adacore.com/gems/gem-140-bridging-the-endianness... (I think it was added in a recent language revision).
Add to that the 'Component_Size attribute and the ability to specialize representation information easily : https://www.adacore.com/gems/gem-27 https://www.adacore.com/gems/gem-27 and https://www.adacore.com/gems/gem-28 https://www.adacore.com/gems/gem-28) and also the ability to recursively bound-check record structures (see https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/implementation_defined_attributes.html#attribute-valid-scalars https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/i... and https://dwheeler.com/lovelace/s17s4.htm https://dwheeler.com/lovelace/s17s4.htm for some background on 'valid and specific Ada safety extensions) you get a pretty elegant and powerful way to interact with low-level constructs.
- MisterTea 8y agoAh Ada. Reminded me of my high school years playing with Turbo pascal before moving to c/c++. First concurrent language I ever worked with. Thought that feature was brilliant, so much nicer than pthreads. I took a small threaded c project of mine and replaced the pthreading with Ada and linked the c logic to it using gnat/gcc. Then along came Go, et al, and my interest in Ada unfortunately faded. Now you got me thinking about Ada again.
- touisteur 8y agoTo jog your memory and for the curious reading this, a chapter of the new 'learn Ada' interactive tutorial by AdaCore introduces tasking: https://learn.adacore.com/courses/intro-to-ada/chapters/tasking.html https://learn.adacore.com/courses/intro-to-ada/chapters/task... The whole interactive book deserves a look. You can then jump to the Spark book :-D https://learn.adacore.com/courses/intro-to-spark/index.html https://learn.adacore.com/courses/intro-to-spark/index.html that sadly doesn't seem to talk about tasking but Spark supports part of it. I'm actually looking forward the next few years, as AdaCore seems to be working on memory ownership-based guarantees a la rust (at least partially) and this might make Ada (or Spark in a first pass) a good candidate for truly fearless concurrency :-D.