Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!.POSTED!nerds-end From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.compilers Subject: Re: Is multi-level function return possible? Date: Mon, 24 Mar 2014 17:06:07 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 47 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-057@comp.compilers> References: <14-03-020@comp.compilers> <14-03-022@comp.compilers> <14-03-025@comp.compilers> <14-03-030@comp.compilers> <14-03-044@comp.compilers> <14-03-046@comp.compilers> <14-03-047@comp.compilers> <14-03-048@comp.compilers> <14-03-053@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: miucha.iecc.com 1395690184 20703 2001:470:1f07:1126:0:676f:7373:6970 (24 Mar 2014 19:43:04 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 24 Mar 2014 19:43:04 +0000 (UTC) Keywords: design, history, comment Posted-Date: 24 Mar 2014 15:43:04 EDT 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:1179 Andy Walker writes: >On 18/03/14 17:36, Anton Ertl wrote: >> Keeping a feature may just be loyalty, but adding it back after it had >> been removed says something about what the language designer thought >> about the usefulness of the feature. > > Well, it certainly implies that the designer [or the committee!] >is admitting to a mistake. In the case of the C branch of the Algol family, I very much doubt that the designers see it that way. B had a reduced feature set not because the language designer did not like the features they removed, but because B had to work on a very small machine. They added some features back in C, which ran on larger machines. The designers of C++, Java and C# are different persons than the designers of B and C, so if they add a feature, why would they see it as "admitting to a mistake"? >[...] >> "Parameters have a run-time cost": So has access to non-local >> variables. > > That depends on the machine and compiler. The first compiler I >used extensively [for Atlas Autocode] accessed variables at lexical >depth N by offsetting from register N, so all variables were accessed >at exactly the same cost. So this compiler maintained a display in the registers. The costs here are: 1) Accessing the variable in memory, whereas a parameter can be passed in a register and accessed in a register. 2) Maintaining the display. AFAIK it turned out that maintaining the display is more costly in typical uses than the access cost it saves, so displays fell out of favour. This means that the run-time cost of non-local variables is typically even more costly on this implementation than one an implementation going using static link chains. - anton -- M. Anton Ertl anton@mips.complang.tuwien.ac.at http://www.complang.tuwien.ac.at/anton/ [We do forget that Ritchie's C compiler ran in 12K bytes of RAM, two passes plus assembler, and generated quite respectable code for the PDP-11. -John]