Newsgroups: comp.arch Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.glorb.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!kithrup.com!mrs From: mrs@kithrup.com (Mike Stump) Subject: Re: The freedom that give us C++ and C Message-ID: Date: Sat, 30 Jan 2016 03:31:22 GMT References: <58721b88-b5b7-4ba5-b32c-06cf8a14d730@googlegroups.com> <2016Jan28.174621@mips.complang.tuwien.ac.at> Organization: Kithrup Enterprises, Ld. X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Lines: 99 X-Received-Bytes: 4730 X-Received-Body-CRC: 1536136773 Xref: csiph.com comp.arch:33306 In article <2016Jan28.174621@mips.complang.tuwien.ac.at>, Anton Ertl wrote: >mrs@kithrup.com (Mike Stump) writes: >>His point isn't that he is willing to defer to the >>implementation; his point is that he will decide to the exclusion of >>all others including the implementation what the definition is. > >You keep repeating that claim, but it's contrary to my position: Is your position that the compiler can pick any semantics it wants for an undefined behavoir, without any limitations whatsoever, and you will be happy with it? >My position is that the compiler should provide stable behaviour We do. It is stable. Stably undefined. Your position, as we can see above, is you want to pick the behavior of the compiler to the exclusion of all others. If you didn't want to do this, then you would allow the compiler to do anything it wanted, and you _would_ be happy. You aren't, so letting the compiler pick, isn't in the cards for you. You will decide after the compiler chooses, if you want to allow that to be a valid solution. You want gcc to alter the behavior in those cases, you are unhappy with. How can we know this, because you're unhappy with that gcc does, today. You are unhappy with the choice gcc _has_ made. Just ask yourself. Now, ask youself, if you can make gcc do _anything_ you wanted, would you be happy? I presume the answer is yes, would I be correct? QED. >(stable for the particular platform), across compiler versions, and >across optimization levels. I.e., it's not me who defines what >undefined behaviour means, it's you, the compiler maintainers; No. You just defined it, please reread what you just wrote. You want it to be stable for the platform. You want it to be stable across compiler versions, you want it to be stable across optimization levels. These are constraints, your constraints, of _your_ decision on what _you_ want the compiler to be. gcc's decision is, as it is today. gcc's decision does not conform to your constraints. >but you don't get to chose one behaviour in one context and a >different behaviour in another context (except possibly when >explicitly asked for). See, again, dictates from you. We can know this, because you just wrote them down. >It's you who wants to decide to the exclusion of all others Yes, precisely. I want to impose the require behavior as mandated by the language standard on the compiler. I do this to the exlcusion of everyone on the planet. I do plead guilty. >You don't want to provide a compiler that provides a stable behaviour >for cases where the C standard does not define the behaviour. Right. >By using the behaviour I ask for in some contexts you are excluding >all those that want a different behaviour, but in addition you want >to also exclude me and all the programmers of code with undefined >behaviour. Right. It is a moral choice. You will burn in Hell if you do X. You are free to do what you want, go have at it. Just, when the flames come a licken, don't ask me for no fire extinguisher. What you miss, is an comprehension of why we do this. What you want isn't possible. What are the semantics of *(int*)0x1000? You decide, you tell me. The problem is that anything you pick, constrains me. I can't bug fix security holes in the standard library, if I only pick the right value of 0x1000. You prevent any change to the runtime libraries by picking any value. The game cannot be won on your terms. The best you can do, is say, well, I didn't mean that. >>The semantics are too important >>and can't be left to the implementation, he decides what they are to >>be. > >On the contrary, I am fine with the behaviour (semantics) provided by the >implementation, but it should be consistent. No. Right there, read your words, you are not fine with them. You place a requirement, that they be consistent. This is not now, nor has it ever been theoretically _or_ in practice, possible. If it were, you could tell me what printf ("%d", *(int*)0x1000); prints.