Understanding how Ada serializes a record

I would like to be able to predict what will happen in the resulting binary when I call Write in Ada to serialize the record. Do you know where I can watch this?

I have outdated Ada software that creates a binary file by writing a record, and I need to debug a C ++ program that needs to write a compatible binary file. So, I would like to understand what Ada rules follow when it serializes a record, so that I can make sure that the C ++ code will create a functionally equivalent record.

+3
source share
4 answers

, . . , Ada . , , . , .

+1

"Write" .

, , , ( ). GNAT ( GCC Ada) .

, "Write ". XML.

+3

, , pragma PACK pragma PRESERVE_LAYOUT . , . :

: 8, 16 32 -

Float: 32- IEEE

Long_Float: 64- IEEE

: 8, 16 32 ; 16 32

: Integer, 0

Booleans: , 8 , LSB : 0 = false, 1 = true

: , 8 , 0 127

: 32 , 32- 0 NULL

: , . , .

+2

Ada95 ( 13.13.2):

"For elementary types, the representation in terms of stream elements is determined by the implementation. For composite types, the Write or Read attribute for each component is invoked in canonical order. The canonical order of components is the last size, the fastest for an array, and the positional aggregate order for writing."

+1
source

Source: https://habr.com/ru/post/1697056/


All Articles