Re:The history of Digital Research's Gemdos for the Atari ST
by pavlov on Wednesday February 14, 2024 @08:26AM
(#39369493)
Maybe it’s a way to highlight that returning an expression value directly is possible?
Back then C was rare on home computers. Programmers were more used to BASIC where typically GOSUB / RETURN couldn’t return a value at all.
Re:The history of Digital Research's Gemdos for the Atari ST
by tom_ on Wednesday February 14, 2024 @08:32AM
(#39369544)
I used to do it as well, but I'm not sure why either? (I learned C in the early 90s.) The reference material was never great back in those days, so maybe I just started doing it by extending the rules for if(), while(), for() and function calls and not getting any pushback from the compiler.
Eventually I stopped because it saves 1 byte and means pressing fewer keys.
Re:The history of Digital Research's Gemdos for the Atari ST
by CakeEngine on Wednesday February 14, 2024 @09:56AM
(#39370451)
Another early 90s C learner here, and I also put (and still do!) parentheses around return expressions. But I do:
`return( 1 );`
not `return (1);`
...because the bracket belongs to the return, not the expression. It's by analogy with 'if' and 'while', a mental "look out, here comes an expression" warming.
Re:The history of Digital Research's Gemdos for the Atari ST
by icedchai on Wednesday February 14, 2024 @09:59AM
(#39370492)
I looked at some C code I wrote about 25 years ago. It all followed the return(N) convention. I also learned C on an Amiga, coincidentally. I started with Lattice / SAS C...
Re:The history of Digital Research's Gemdos for the Atari ST
by JNRowe on Wednesday February 14, 2024 @10:53AM
(#39371324)
dmr's reference manual¹ used it, see section 9.10.
Matt Dillon's DICE would have been popular on the Amiga then, and it looks like it also favored parens. The latest tarball of DICE² is pretty fun for a spelunking session, if you're feeling nostalgic. It makes for an interesting mix as it pulls in a few contemporaneous non-Dillon tools with varying styles.
Re:The history of Digital Research's Gemdos for the Atari ST
by lproven on Wednesday February 14, 2024 @12:52PM
(#39372818)
The same Matt Dillon that went on to start Dragonfly BSD, of course.
Re:The history of Digital Research's Gemdos for the Atari ST
by unwind on Friday February 16, 2024 @03:22PM
(#39402454)
Wow I had almost forgotten those names, thanks!
Re:The history of Digital Research's Gemdos for the Atari ST
by AnimalMuppet on Wednesday February 14, 2024 @12:16PM
(#39372351)
Is it to visually distinguish from an empty return? That is,
return 1;
is visually closer to return;
than return (1);
is.So this could be a way of signaling "hey, I'm returning a value here, not just leaving the function".
But I'm just speculating...
Re:The history of Digital Research's Gemdos for the Atari ST
by convolvatron on Wednesday February 14, 2024 @01:42PM
(#39373494)
I am extremely biased. but I always think of return as an implicitly bound continuation. so it seems quite natural to want to call it.
So
instead of just I remember using the former style as I tried (in frustration) to learn C back on the Amiga (so roughly at the same time, late 80s/early 90s) using articles in magazines.Does anyone know where it comes from?
Some time later (late 90s) at university I learned C again but with actual (good!) teachers, and also got exposed to way more code and talk about code thanks to Internet and comp.lang.c etc, and around that time (I think?) I stopped using them.
Nowadays they always make me think the author is anxious that the function will return before the entire expression is evaluated, which makes me smile. :)