Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitwise Operations in Ada

Is there a tutorial somewhere that explains on which datatypes bitwise operations can be used? I don't know why Lady Ada thinks that I cannot bitwise OR two Standard.Integer...

$ gnatmake test.adb
gcc -c test.adb
test.adb:50:77: there is no applicable operator "Or" for type "Standard.Integer"
gnatmake: "test.adb" compilation error

Really? I excused the compiler for not being able to AND/OR enumerated data types. I excused the compiler for not being able to perform bitwise operations on Character type. I excused the compiler for not being able to convert from Unsigned_8 to Character in what I thought was the obvious way. But this is inexcusable.

like image 257
Arjun Avatar asked Nov 27 '22 02:11

Arjun


1 Answers

Ada doesn't provide logical (bit-wise) operations on integer types, it provides them on modular types. Here's the section in the reference manual.

like image 178
Marc C Avatar answered Dec 05 '22 09:12

Marc C