volatile (in comp.lang.c)

Dieter Woerz woerz at iaoobelix.UUCP
Sun May 15 03:42:39 AEST 1988


In article <1011 at ima.ISC.COM> johnl at ima.UUCP (John R. Levine) writes:
> ...
>or another.  But whether "volatile" belongs in the standard is entirely another
>thing.  The standard defines a language for writing portable programs, i.e.
>any standard-conforming program should do the same thing on all ANSI C
>processors.  I have never seen any suggestion that a program containing
>"volatile" would be portable except perhaps to other processors which happen
>to have similar memory, I/O, and hardware architectures.
> ...

I don't see, what "volatile" has todo with the hardware architecture.
In my understanding, "volatile" simply says that the compiler has to
access the variable in the memory every time the variable is access-
ed. There seems to be nothing dependent on the hardware, exept that
you can't get access to I/O ports on architectures, which don't have
memory mapped I/O. So "volatile" has nothing todo with portability,
because every compiler can be made to access a variable in memory
every time it is read or writtten.

I agree, that if you depend on "volatile" for doing memory mapped
I/O, that wouldn't be too portable on an architecture with port I/O.
But that low level I/O-Software normally doesn't have to be portable.

------------------------------------------------------------------------------

Dieter Woerz
Fraunhofer Institut fuer Arbeitswirtschaft und Organisation
Abt. 453
Holzgartenstrasse 17
D-7000 Stuttgart 1
W-Germany

BITNET: iaoobel.uucp!woerz at unido.bitnet
UUCP:   ...{uunet!unido, pyramid}!iaoobel!woerz



More information about the Comp.lang.c mailing list