Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" Newsgroups: comp.arch Subject: Re: Memory ordering Date: Thu, 19 Dec 2024 21:08:19 -0800 Organization: A noiseless patient Spider Lines: 27 Message-ID: References: <5yqdnU9eL_Y_GKv6nZ2dnZfqn_GdnZ2d@supernews.com> <2024Nov15.082512@mips.complang.tuwien.ac.at> <20241115152459.00004c86@yahoo.com> <2024Nov17.161752@mips.complang.tuwien.ac.at> <2024Dec3.100144@mips.complang.tuwien.ac.at> <3aa9f0a3d3dde86193abb1c01e52d03a@www.novabbs.org> <86wmgejgxv.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 20 Dec 2024 06:08:20 +0100 (CET) Injection-Info: dont-email.me; posting-host="90d0359d260b5ab20f7104a3aa6ad836"; logging-data="3469370"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197HzKhTOwT7YVWbQ2v40VAElMauDTcTiw=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:DuTVycxj5UuPWjNUbRXpivnk10U= In-Reply-To: <86wmgejgxv.fsf@linuxsc.com> Content-Language: en-US Bytes: 2495 On 12/5/2024 7:19 AM, Tim Rentsch wrote: > scott@slp53.sl.home (Scott Lurndal) writes: > >> mitchalsup@aol.com (MitchAlsup1) writes: >> >>> On Tue, 3 Dec 2024 13:59:18 +0000, jseigh wrote: >>> >>>> The compiler is allow to reorder code as long as it knows the >>>> reordering can't be observed or detected. >>> >>> With exceptions enabled, this would allow for almost no code >>> movement at all. >>> >>>> If there are places >>>> in the code it doesn't know this can't happen it won't optimize >>>> across it, more or less. >>> >>> The problem is HOW to TELL the COMPILER that these memory references >>> are "more special" than normal--when languages give few mechanisms. >> >> C and C++ have the 'volatile' keyword for this purpose. > > A problem with using volatile is that volatile doesn't do what > most people think it does, especially with respect to what > reordering is or is not allowed. Ditto.