Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2820
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: what is defined, was for or against equality |
| Date | 2022-01-11 18:16 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <22-01-044@comp.compilers> (permalink) |
| References | (3 earlier) <22-01-020@comp.compilers> <22-01-027@comp.compilers> <22-01-032@comp.compilers> <22-01-038@comp.compilers> <22-01-041@comp.compilers> |
On 10/01/2022 13:04, Thomas Koenig wrote: > David Brown <david.brown@hesbynett.no> schrieb: > >> The big question here, is why do you think Fortran is any different? In >> theory, there isn't a difference - nothing you have said here convinces >> me that there is any fundamental difference between Fortran and C in >> regards to undefined behaviour. > > I am not sure how to better explain it. I will try a bit, but > this will be my last reply to you in this thread. We seem to have > a fundamental difference in our understanding, and seem to be > unable to resolve it. > Fair enough. Maybe in a future discussion, one of us will have an "Aha!" moment and understand the other's viewpoint, and progress will be made - until then, there's no point in going around in circles. I'll snip bits of your post here, and try to minimise new points (unless I get that "Aha!") - but be sure I am reading and appreciating your entire post. >> (And there's no difference in the >> implementations - the most commonly used Fortran compilers also handle >> C, C++, and perhaps other languages.) > > Sort of. > > At the risk of boring most readers of this group, a very short, but > (hopefully) pertinent introduction of how modern compilers work: > > > There is no compiler (if you mean a single binary) that handles both > C and Fortran. They are separate front ends to common middle > and back ends. Yes. But it is the middle end that handles most of the optimisations, including those based on undefined behaviour. The front end determines whether code can have undefined behaviour and in what circumstances. >> C does not have a "write" function in the standard library. So the >> behaviour of "write" is not defined by the C standards - but that does >> not mean the behaviour is undefined. > > When interpreting at a language standard, you _must_ follow the > definitions in the standards if they exist, you cannot use everyday > interpretations. > > Subclause 3.4.3 (N2596) defines > > # undefined behavior > > # behavior, upon use of a nonportable or erroneous program > # construct or of erroneous data, for which this document imposes > # no requirements > > write() is nonportable and the C standard imposes no requirements > on it. Therefore, the program above invokes undefined behavior. No. (As always, this is based on my interpretation of the standards - consider everything to have "IMHO" attached.) The implementation of "write" is outside the scope of the standards, and is therefore undefined as far as the standards are concerned. That does not make it undefined behaviour in the program - it just means the standards don't say what "write" should do.
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Re: for or against equality, was Why are ambiguous grammars usually a bad idea? Martin Ward <martin@gkc.org.uk> - 2022-01-05 10:25 +0000
Re: for or against equality, was Why are ambiguous grammars usually a bad idea? David Brown <david.brown@hesbynett.no> - 2022-01-06 09:11 +0100
Re: what is defined, was for or against equality Thomas Koenig <tkoenig@netcologne.de> - 2022-01-06 16:43 +0000
Re: what is defined, was for or against equality David Brown <david.brown@hesbynett.no> - 2022-01-07 12:06 +0100
Re: what is defined, was for or against equality Spiros Bousbouras <spibou@gmail.com> - 2022-01-07 13:21 +0000
Re: what is defined, was for or against equality Thomas Koenig <tkoenig@netcologne.de> - 2022-01-08 09:31 +0000
Re: what is defined, was for or against equality Spiros Bousbouras <spibou@gmail.com> - 2022-01-08 22:28 +0000
Re: what is defined, was for or against equality Thomas Koenig <tkoenig@netcologne.de> - 2022-01-09 00:09 +0000
Re: what is defined, was for or against equality Spiros Bousbouras <spibou@gmail.com> - 2022-01-09 21:30 +0000
Re: what is defined, was for or against equality David Brown <david.brown@hesbynett.no> - 2022-01-09 23:00 +0100
Re: what is defined, was for or against equality Thomas Koenig <tkoenig@netcologne.de> - 2022-01-10 12:04 +0000
Re: what is defined, was for or against equality David Brown <david.brown@hesbynett.no> - 2022-01-11 18:16 +0100
Re: what is defined, was for or against equality Kaz Kylheku <480-992-1380@kylheku.com> - 2022-01-11 19:19 +0000
Re: what is defined, was for or against equality gah4 <gah4@u.washington.edu> - 2022-01-11 14:18 -0800
Re: what is defined, was for or against equality Thomas Koenig <tkoenig@netcologne.de> - 2022-01-12 19:02 +0000
Re: what is defined, was for or against equality David Brown <david.brown@hesbynett.no> - 2022-01-13 08:24 +0100
Re: what is defined, was for or against equality Thomas Koenig <tkoenig@netcologne.de> - 2022-01-13 11:17 +0000
Re: what is defined, was for or against equality gah4 <gah4@u.washington.edu> - 2022-01-10 16:58 -0800
Re: for or against equality, was Why are ambiguous grammars usually a bad idea? Robert Prins <robert@prino.org> - 2022-01-06 19:07 +0000
Undefined behaviour, was: for or against equality Martin Ward <martin@gkc.org.uk> - 2022-01-07 14:02 +0000
Re: Undefined behaviour, was: for or against equality Spiros Bousbouras <spibou@gmail.com> - 2022-01-08 03:41 +0000
Re: Undefined behaviour, was: for or against equality David Brown <david.brown@hesbynett.no> - 2022-01-07 15:56 +0100
Re: Undefined behaviour, was: for or against equality anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-01-08 17:52 +0000
Re: Undefined behaviour, was: for or against equality David Brown <david.brown@hesbynett.no> - 2022-01-09 23:53 +0100
Re: Undefined behaviour, was: for or against equality Kaz Kylheku <480-992-1380@kylheku.com> - 2022-01-11 16:55 +0000
Re: Undefined behaviour, was: for or against equality George Neuner <gneuner2@comcast.net> - 2022-01-11 22:01 -0500
csiph-web