Path: utzoo!utgpu!water!watmath!clyde!ima!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: volatile Message-ID: <18642@think.UUCP> Date: 30 Mar 88 02:38:40 GMT References: <12578@brl-adm.ARPA> <1988Mar25.172355.348@utzoo.uucp> <588@imagine.PAWL.RPI.EDU> <1988Mar29.004454.2867@utzoo.uucp> <134@wyse.wyse.com> Sender: usenet@think.UUCP Reply-To: barmar@fafnir.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 27 In article <134@wyse.wyse.com> mikew@wyse.UUCP (Mike Wexler) writes: >I would disagree that is isn't possible to write portable code that requires >volatiles. An example(possibly the only one), is the use of System V >or Berkeley shared memory. With either of these you can have volatile >values in portable(At least to similar Unix systems) programs. Given >this it might be useful for the Posix standard to require the C compiler >to support volatile or a volatile pragma. But such programs are NOT portable. A program using System V shared memory is not portable to a BSD system and vice-versa. And none of them are portable to non-Unix systems. As you yourself implied in your last sentence, the right place for such a requirement is in the Posix standard, not the C standard. And the mechanism that can be used for this is #pragma. The C standard doesn't specify the format of particular pragmas (whether this is wise is debatable), but Posix already requires various extra C features (for example, I believe it adds things to include files that are specified in the C standard), so it could also require that compilers implement a particular set of pragmas with a given syntax. Barry Margolin Thinking Machines Corp. barmar@think.com uunet!think!barmar