At Wed, 26 Feb 2020 00:12:49 -0500 (EST), Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote: Subject: Re: NULL pointer arithmetic issues > > > This is the main point of my original rant. "Undefined Behaviour" as > > it has been interpreted by Optimization Warriors has given us an > > unusable language. > > I'd say that it's given you unusuable implementations of the language. > The problem is not the language; it's the compiler(s). (Well, unless > you consider the language to be the problem because it's possible to > implement it badly. I don't.) I don't think the C language (in all lower-case, un-quoted, plainly) is the problem -- I think the problem is the wording of the modern standard, and the unfortunate choice to use the phrase "undefined behaviour" for certain things. This has given "license" to optimization warriors -- and their over-optimization is the root of the evil I see in current compilers. It is this unfortunate choice of describing things as "undefined" within the language that has made modern "Standard C" unusable (especially for any and all legacy code, which is most of it, right?). If we outlawed the use of the phrase "undefined behaviour" and made all instances of it into "implementation defined behviour", with a very specific caveat that such instances did not, would not, and could not, ever allow optimizers to even think of violating any possible conceivable principle of least astonishment. E.g. in the example I gave, the only thing allowed would be for the implementation to do as it please IFF and when the pointer passed was actually a nil pointer at runtime (and perhaps in this case with a strong hint that the best and ideal behaviour would be something akin to calling abort()). -- Greg A. Woods <gwoods%acm.org@localhost> Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost> Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgpky_RJxDpHt.pgp
Description: OpenPGP Digital Signature