TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type:
multipart/mixed; boundary="------------85811289CEB9C776D0C17EF1"
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Subject:
From:
Date:
Fri, 16 Oct 1998 02:44:35 -0700
MIME-Version:
1.0
Organization:
"A" Willow Ware
Reply-To:
Parts/Attachments:
text/plain (285 bytes) , t.lis (1730 bytes)
Hi all,

I am getting this error from GNAT and it is puzzling me a
bit.

Can't we use this attribute to set up a record as big/little
endian as needed?  If I was transferring data from a big
endian machine to a little endian machine wouldn't this
attribute help me from do data marshalling?

Thanks,
Chris Sparks



Compiling: t.adb (source file time stamp: 1998-10-16 09:39:25)      1. with Ada.Text_Io; use Ada.Text_IO;      2. with Ada.Integer_Text_IO;      3. use Ada.Integer_Text_IO;      4. with System;      5.      6. procedure T is      7.      8. type Byte is mod 2 ** 8;      9. type Word is mod 2 ** 16;     10.     11. type Big_Endian is record     12. A : Byte;     13. B : Word;     14. C : Byte;     15. end record;     16. for Big_Endian use record     17. A at 0 range 0 .. 7;     18. B at 0 range 8 .. 23;     19. C at 0 range 24 .. 31;     20. end record;     21. for Big_Endian'Bit_Order use System.High_Order_First;                                                  |         >>> unsupported value for Bit_Order     22.     23. type Little_Endian is record     24. A : Byte;     25. B : Word;     26. C : Byte;     27. end record;     28. for Little_Endian use record     29. A at 0 range 0 .. 7;     30. B at 0 range 8 .. 23;     31. C at 0 range 24 .. 31;     32. end record;     33. for Little_Endian'Bit_Order use System.Low_Order_First;     34.     35. BE : Big_Endian := (10, 20, 30);     36. LE : Little_Endian := (10, 20, 30);     37.     38. BE_Int : Integer;     39. for BE_Int'address use BE'address;     40.     41. LE_Int : Integer;     42. for LE_Int'address use LE'address;     43.     44. begin     45. Default_Base := 2;     46.     47. Put_Line ("BO => " & System.Bit_Order'Image (System.Default_Bit_Order));     48. Put ("BE =>"); Put (BE_Int); New_Line;     49. Put ("LE =>"); Put (LE_Int); New_Line;     50.     51. end T;

ATOM RSS1 RSS2