Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2878
| Path | csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end |
|---|---|
| From | dave_thompson_2@comcast.net |
| Newsgroups | comp.compilers |
| Subject | Re: What is the meaning of an expression? |
| Date | Sun, 30 Jan 2022 22:51:54 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 35 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <22-01-121@comp.compilers> (permalink) |
| References | <AdgJPKhi/NiNfECvRNaA6+4Wq/M8OQ==> <22-01-052@comp.compilers> <22-01-060@comp.compilers> <22-01-066@comp.compilers> <22-01-067@comp.compilers> <22-01-068@comp.compilers> <22-01-069@comp.compilers> <22-01-070@comp.compilers> <22-01-076@comp.compilers> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="40505"; mail-complaints-to="abuse@iecc.com" |
| Keywords | C, history |
| Posted-Date | 31 Jan 2022 10:35:15 EST |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Xref | csiph.com comp.compilers:2878 |
Show key headers only | View raw
On Thu, 20 Jan 2022 13:02:34 +0100, Hans-Peter Diettrich <DrDiettrich1@netscape.net> wrote: ... > ARAIR K&R C defined the value of a function call to be the value > contained in the accumulator after return. A decision with horrible > consequences if you look at compiler and library source code of that > time. OTOH it derogates the meaning of an expression if at any time one > can find a value in the defined result register. ... > [Early C didn't have default return values, but since the compilers also > didn't do much type checking, I can believe there was a code that > worked by accident becaues the value of the last expression in a function > happened to be in the register where the caller looked for the result. ...] Through K&R1 C didn't have 'void' -- all functions had some return type, which if not written defaulted to 'int' (as in BCPL and B). The _compilers_ did typecheck but not most _linkers_ so a mismatch across separately-compiled files was one way to get this problem; one of the features of 'lint' was to catch such. (FORTRAN had the same issue, and there were some tools for it, but I don't recall one as prominent. COBOL, at least then, didn't have value-returning subprograms, although it could have mismatch on arguments. I don't recall what Pascals did -- when they had separate compilation at all -- and never saw a non-toy algol. C++ overloading effectively required typesafe linkage, and Ada assumed a 'repository' preventing mismatches.) Another way is if you 'fall off the end' of a (non-void) function, or through the first standard (C89/90) you wrote and executed a return statement with no expression; before void this was widely used for functions with no useful value. If the callsite doesn't discard the notional 'value' of a call that does one of these, it is officially undefined behavior and in practice usually takes whatever value is lying about in the register used by the calling sequence -- but on PDP-11 and Interdata at least that wasn't 'the accumulator' because they had no such thing.
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
What is the meaning of an expression? Roger L Costello <costello@mitre.org> - 2022-01-14 12:15 +0000
Re: What is the meaning of an expression? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-01-14 18:20 +0000
Re: What is the meaning of an expression? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-01-15 00:28 +0100
Re: What is the meaning of an expression? gah4 <gah4@u.washington.edu> - 2022-01-14 17:58 -0800
Re: What is the meaning of an expression? George Neuner <gneuner2@comcast.net> - 2022-01-15 02:05 -0500
Re: What is the meaning of an expression? "matt.ti...@gmail.com" <matt.timmermans@gmail.com> - 2022-01-15 06:21 -0800
Re: What is the meaning of an expression? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2022-02-03 12:50 +0000
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-16 07:44 -0800
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-17 15:45 -0800
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-18 10:03 -0800
Re: What is the meaning of an expression? gah4 <gah4@u.washington.edu> - 2022-01-18 15:18 -0800
Re: What is the meaning of an expression? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-01-19 11:54 +0100
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-19 09:17 -0800
Re: What is the meaning of an expression? gah4 <gah4@u.washington.edu> - 2022-01-19 14:03 -0800
Re: What is the meaning of an expression? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-01-20 13:02 +0100
Re: What is the meaning of an expression? dave_thompson_2@comcast.net - 2022-01-30 22:51 -0500
Re: What is the meaning of an expression? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-01-19 20:13 +0200
Re: What is the meaning of an expression? Thomas Koenig <tkoenig@netcologne.de> - 2022-01-22 20:46 +0000
Re: What is the meaning of an expression? Thomas Koenig <tkoenig@netcologne.de> - 2022-01-19 20:51 +0000
csiph-web