Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.lang.c Subject: Re: on allowing "int a" definition everywhere Date: Tue, 3 Sep 2024 04:54:10 -0000 (UTC) Organization: A noiseless patient Spider Lines: 26 Message-ID: References: <7ea05965a67fa09d4ebd0b6ec53109dcb0b12f76@i2pn2.org> <3775b5abd14443f89852e05177a44bd72585cbdd@i2pn2.org> <4c7a695b1b755393162a1ae36ea6306760ffe949@i2pn2.org> <41520456e45d778ea26805f6f711a05757365bc3@i2pn2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 03 Sep 2024 06:54:10 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6d8b6590145ff0d1f13101405f5f220c"; logging-data="3395608"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197cxmcRDFn7tmllgq+wxnH" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:elhfk06SSwAuiwnZU+w25cHfzvY= Bytes: 2374 On Mon, 2 Sep 2024 10:53:33 +0100, Bart wrote: > On 02/09/2024 04:32, Lawrence D'Oliveiro wrote: >> On Tue, 27 Aug 2024 19:59:13 +0100, Bart wrote: >> >>> void draw_line(f32 x, y, x2, y2; u32 colour) { >>> >>> - Allow shared types in parameter lists ... >> >> A bit easier if you flip it around and use Pascal-style syntax: >> >> procedure draw_line(x, y, x2, y2 : f32; colour : u32) >> >> See how much more natural that is? > > It becomes a bit less natural when you want to initialise a variable at > the same time, or want define a default value for a parameter. > > Pascal didn't allow either of those. Ada does, with a very natural extension of the same syntax. Even allows passing arguments by keyword, too. Note that even C++ has now had to allow function return types to be specified at the end of the prototype instead of up front, because type interdependencies don’t work very well otherwise.