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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c8bbb1419c8e81a X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Waiver question Date: 1997/05/02 Message-ID: #1/1 X-Deja-AN: 238774603 References: <5k52k2$7v0$1@news.nyu.edu> <5kb8ol$18o@bcrkh13.bnr.ca> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-05-02T00:00:00+00:00 List-Id: In article <5kb8ol$18o@bcrkh13.bnr.ca>, Kaz Kylheku wrote: >Because you may wish to code an interrupt service routine for an embedded >system without dropping down to the assembly language level. In that case >it becomes important to know that you can modify some variable atomically; >you suddenly care how the access is compiled into machine code. It's not >practical or desirable to write interrupt service routines in assembly >language. > >If access to that object is not atomic, the process that was interrupted could >have been in the middle of trying to read that variable. No, I don't buy that. If you want to modify variables atomically in Ada, then you use pragma Atomic. And it's no big deal if that causes an 8-bit thing to take up 32 bits. The real answer to my question, as Robert Dewar e-mailed to me privately, is that variables (including components) are independently addressable by multiple tasks, unless they're part of a pragma-packed type. If you have a record containing three booleans, then on a Pentium, it will fit in three bytes, whereas on an Alpha (early versions), it will need 12 bytes. Unless there's a pragma Pack (in which case it will be three *bits* on both machines). If task 1 refers to X.Y, and task 2 refers to X.Z, that's supposed to be OK, unless the type of X has a pragma Pack. Strange semantics, IMHO. Pragma Pack is all about time-vs-space trade-offs, but it has this weird side-effect on tasking semantics. We should have a way to *declare* things independently adressable, but the default should be that things are not. Instead of forcing the compiler to assume that *everything* is independently addressable. - Bob