Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: gah4 Newsgroups: comp.compilers Subject: Re: another C-like language? was Compilers :) Date: Tue, 10 Jan 2023 15:13:33 -0800 (PST) Organization: Compilers Central Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-01-034@comp.compilers> References: <23-01-001@comp.compilers> <23-01-002@comp.compilers> <23-01-003@comp.compilers> <23-01-008@comp.compilers> <23-01-016@comp.compilers> <23-01-029@comp.compilers> <23-01-033@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="7917"; mail-complaints-to="abuse@iecc.com" Keywords: assembler, history, comment Posted-Date: 10 Jan 2023 19:56:09 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <23-01-033@comp.compilers> Xref: csiph.com comp.compilers:3302 On Tuesday, January 10, 2023 at 2:16:32 PM UTC-8, David Brown wrote: (snip) > The point is that you do not declare a variable until you actually have > something to put in it. You never have this semi-alive object floating > around where it is accessible, but has no valid or known state. You > never have an artificial initialisation, such as putting 0 in a variable > declared at the top of the function, in the mistaken believe that it > makes code somehow "safer". Java requires that the compiler be able to figure out that a variable (well, scalar variable) is given a value before it is used. Most of the time, that works out fine. Once in a while, I know that it is given a value, but the compiler doesn't. In that case, it is initialized to (usually) 0, and a comment indicating why. (snip) > [Variables at the top probably comes from Algol60 via Pascal. For assembler, > depends on the assembler. Lots of them let you have several sections in the > program and switch between the code and data sections as you go. IBM mainframe > assemblers had this feature in the 1960s. -John] Most of the IBM mainframe assembly code I know, puts the variables at the bottom. Well, early on I started reading the generated code from compilers, and not so much later, the Fortran G&H library. Maybe not the best examples of structured code, though. Well, if by data section you mean DSECT, I suppose. Most I knew didn't do much of that, though. Variables at the bottom, and use the same base register for code and data. You could put the variables at the top, and branch around them. I don't remember anyone doing that. More recent processors, maybe from ESA/390 days, have data and instruction cache, and want data and instructions more than (if I remember) 256 bytes apart. But okay, it is completely different for reentrant programs, than the static allocation non-reentrant code of much of OS/360 associated programs. [For IBM assember, I meant that you could have one CSECT for your code and another for your data, and you could switch between them as you go along. For the elite few of us who used TSS/360, a PSECT let you set the initial contents of the RW data that the RO code in a routine used. DSECT was somehing else, more like a structure definition. I realize that in practice most code was not reentrant and you put all your code and data in one section. -John]