From mboxrd@z Thu Jan 1 00:00:00 1970 From: steffen@sdaoden.eu (Steffen Nurpmeso) Date: Wed, 04 Jan 2017 18:38:04 +0100 Subject: [TUHS] Unix stories In-Reply-To: <017201d266ab$cda885a0$68f990e0$@ronnatalie.com> References: <5257291ca0a0e1d80c646cab730129d589c5d707@webmail.yaccman.com> <42922C34-342F-4E86-83E2-3618129139B2@tfeb.org> <20170103004959.GA29088@mcvoy.com> <20170104130434.NQFzLGpVU%steffen@sdaoden.eu> <1483538831.1573798.837053385.2EB8CAC9@webmail.messagingengine.com> <012e01d2669a$6b2f89c0$418e9d40$@ronnatalie.com> <1483545543.1599443.837188969.6EAAD62B@webmail.messagingengine.com> <20170104163017.XtxbzN7PQ%steffen@sdaoden.eu> <1483547544.1606930.837228297.014AB061@webmail.messagingengine.com> <20170104165120.rYUyVGovj%steffen@sdaoden.eu> <1483548842.1612851.837252537.064CFDA2@webmail.messagingengine.com> <017201d266ab$cda885a0$68f990e0$@ronnatalie.com> Message-ID: <20170104173804.xrkvjknBx%steffen@sdaoden.eu> "Ron Natalie" wrote: |There's a trademark between allowing the compiler to reorder things \ |and having a defined order of operations. |Steps like that are well-defined in Java for instance. C lets the \ |compiler do what it sees fit. | |Note that it's not necessarily any better in assembler. There are \ |RISC architectures where load-followed-by-store and vice versa may \ |not always be valid if done in quick succession. Requiring the compiler \ |to insert sequence points typically wastes a lot of cycles. Assembler \ |programmers tend to think about what they are doing, the C compiler \ |tries to do some of this on its own and its not clairvoyant. I have just read again Clive Feather's ISO/IEC JTC1/SC22/WG14 N925 draft on sequence points, and i seem to be wrong about especially the shown exampl,e and Random knew that earlier. I first read that document in the context of aliasing issues a few years back, when i saw some BSD changesets fly by, and i remember a thread on a FreeBSD list, too, where objects backing pointers could no longer be accessed directly, but first need to be copied over to some -- then newly introduced -- local scope storage before being used, because of new aliasing rules of the C language. It seems i hyperventilated in the sequence point document back then. --steffen