Deutsch English Français Italiano |
<b90fed6881dbe30d030bb5dd04e8e78c@www.novabbs.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: mitchalsup@aol.com (MitchAlsup1) Newsgroups: comp.arch Subject: Re: ALTER, ASSIGN and labels-as-values Date: Mon, 27 May 2024 18:21:43 +0000 Organization: Rocksolid Light Message-ID: <b90fed6881dbe30d030bb5dd04e8e78c@www.novabbs.org> References: <v1ep4i$1ptf$1@gal.iecc.com> <v1ns43$2260p$1@dont-email.me> <2024May11.173149@mips.complang.tuwien.ac.at> <v1preb$2jn47$1@dont-email.me> <2024May12.110053@mips.complang.tuwien.ac.at> <6124140226e28fd4afec0b435bdbeca1@www.novabbs.org> <2024May18.104040@mips.complang.tuwien.ac.at> <v2ang4$2smfg$1@dont-email.me> <34sk4jdhf1crb73jdns37e462ciumq5fjp@4ax.com> <v2ubim$3908a$1@dont-email.me> <2024May26.105139@mips.complang.tuwien.ac.at> <raH4O.2057$dWi1.1038@fx42.iad> <2024May27.100509@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: i2pn2.org; logging-data="2405319"; mail-complaints-to="usenet@i2pn2.org"; posting-account="65wTazMNTleAJDh/pRqmKE7ADni/0wesT78+pyiDW8A"; User-Agent: Rocksolid Light X-Rslight-Site: $2y$10$MfYJ7nULUUcOG1e43Yaiu.NxzCpxmfLmFfNmdhbFYi85U7C2FLQTm X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8 X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 2761 Lines: 40 Anton Ertl wrote: > EricP <ThatWouldBeTelling@thevillage.com> writes: >>Don't forget Fortran's alternate returns, indicated by a * in the arg >> list. >>A caller subroutine passes *labels in the args list, and callee decides >>which *label-arg it wants to return to in the RETURN statement constant >>expression. (This is not ambiguous because in Fortran function return >>values are done by assignment to the function name, not the return >>statement expression.) >> >>call Foo (*100, *200) >>... >>100 >>... >>200 >>... >>end >> >>subroutine Foo (*, *) >>... >>return 1 ! Return to callers first * label arg >>... >>return 2 ! Return to callers second * label arg >>... >>end > Interesting. Rudimentary explicit continuation-passing style at the > dawn of programming languages. Of course, these days it would mean > that you better not use the common call and return instructions, > because the branch prediction for the return would be wrong if return > 1 or return 2 would be used. But using plain jump for the call and > indirect jumps for the returns should be efficient on modern CPUs. That is why the subroutine returns a value and the return point implements the switch (control transfer to proper label. {You DO NOT return to the label, you return normally and then go to the proper label.} > - anton