Re: volatile vs aliased
- From: Björn Persson <spam-away@xxxxxxxxxxx>
- Date: Thu, 06 Oct 2005 18:43:12 GMT
Do we have a difference to C/C++ increment operator here? consider
pragma Volatile (x); x := x + 1; -- (1) vs. x++; -- (2)
In the Ada case (1) we are forced to have "read from memory", "increment" and "write to memory" instructions, whereas in C/C++ (2) you can get a single "increment memory" instruction (presuming the mentioned assembler instructions exist on a given processor)
Are there really memory chips with built-in arithmetic circuitry, so that the processor can send an "add one" instruction to the memory and have the variable incremented without reading it first? At least I've never heard of that. As far as I know, adding and subtracting is the processor's job.
And why would you use pragma Volatile on a variable stored in the memory, anyway? As Ludovic described it, it would only be useful on variables mapped to special hardware devices. I don't think you would want to store a counter there.
-- Björn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu .
- Prev by Date: Re: volatile vs aliased
- Next by Date: Re: GNATWIN with GPL edition?
- Previous by thread: Re: volatile vs aliased
- Next by thread: Re: volatile vs aliased