From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Fri, 11 Feb 2011 19:43:15 +0100 Message-ID: References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <4d5008a5$0$6879$9b4e6d93@newsspool2.arcor-online.net> <4d5031fe$0$6765$9b4e6d93@newsspool3.arcor-online.net> <1f229967-d3cf-42b6-8087-c97ee08652f3@i40g2000yqh.googlegroups.com> <4d51169e$0$7657$9b4e6d93@newsspool1.arcor-online.net> <1bnp0pw1c8r5b$.guxc48qweiwe.dlg@40tude.net> <4d51a1c0$0$19486$882e7ee2@usenet-news.net> <87411ec5-c197-4143-8ef1-ab9ddb20bcc6@q40g2000prh.googlegroups.com> <505a0855-ed01-4819-9d8e-025ad8d5cb51@y12g2000prf.googlegroups.com> <82k4h7avir.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: individual.net FFeisPVoIVDiqp+EQWJGBw0AP6p2wJp/D9F4aTFzTddCnfppUc Cancel-Lock: sha1:l6mxYjAxi3L2n+N09yMS5Am5+Rs= User-Agent: Opera Mail/11.01 (Win32) Xref: g2news1.google.com comp.lang.ada:17246 Date: 2011-02-11T19:43:15+01:00 List-Id: Stephen Leake wrote: > "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> > writes: > >> Adam Beneschan wrote: >> >>> In Ada, we'd express this with a >>> representation clause that looks (in part) something like >>> >>> Second_Field at 0 range 5..9; >>> >>> If we did things the way you think is the "right" way, the second >>> field would occupy bits 2, 1, 0, 15, and 14. >> >> That just means, we cannot have a declaration that will do on both >> machines, regardless of what bit-order you specify: > > Not true! That's what 'Bit_Order is for; you tell the compiler what > convention for bit numbers your source code is using, and it does the > right thing for the target hardware. Only in a perfect world. Under certain circumstances (which seem compiler-dependent), it does not work. Admitted, those are rare cases. I just tried it today. "if Bit_Order is specified, field must start on a word boundary". That's not the exact wording, but you get the meaning. GNAT complained with a message about that I should try to use Ada05 mode. And indeed, with -gnat05 it did it with a warning and spit out the bit numbers it used. (Of course, that was a *really* nasty thing, but that's how it was specified by the interface specification. Bottom line is, no matter how you specify it, it only works with one endianess. You still can play the usual tricks, though.) Vinzent. -- You know, we're sitting on four million pounds of fuel, one nuclear weapon, and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it? -- Rockhound, "Armageddon"