🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1162

Re: .5 against 0.5f

#1162
From: Dan Cross
Date: Fri, 30 Oct 2026 10:58
87 lines
4944 bytes
In article <11c0kst$3pmvb$2@kst.eternal-september.org>,
Keith Thompson  <Keith.S.Thompson+u@gmail.com> wrote:
>cross@spitfire.i.gajendra.net (Dan Cross) writes:
>> In article <11bvqbn$3g0tj$1@dont-email.me>,
>> James Kuyper  <jameskuyper@alumni.caltech.edu> wrote:
>>>[snip]
>>>They can lead to people thinking that return is a function, even if they
>>>nominally know better.
>>
>> What?  This is an incredibly weak argument.
>>
>> If someone thought that `return` was a function, then why
>> wouldn't they think that `if` or `while` were also functions?
>> Or `sizeof`, and so on?
>
>I agree that it's a bit of a weak argument, but I wouldn't call it
>incredibly weak.
>
>In my personal coding style, I try to avoid making things that are not
>function calls look like function calls.  In a function call, there's no
>space between the function name and the left parenthesis.  I don't use
>that style for anything other than function calls (or invocations of
>function-like macros).  Not because I don't know return and sizeof are
>keywords, but because it's just a little bit easier to read the code
>if distinctions like that are clear.
>[snip examples]

If I may paraphrase your argument, it's that you like to omit
parentheses where unnecessary, or otherwise make operators
visually distinct from function calls, so that while scanning
code they stand out.

But that is qualitatively different than what Kuyper said: "They
can lead to people thinking that return is a function", which is
ridiculous.  Anyone even passingly familiar with the language
knows that `return` in C is not a function, parentheses or no.

>[snip]
>The premise (at least for me) is not that someone would *think*
>that return is a function, but that making a return statement not
>look too much like a function call makes the code just a little
>bit easier to read.

Perhaps; perhaps not.  My day job involes working on a variant
of System V Unix, which has a very strict style guide similar to
(but different from...) FreeBSD's.  That guide is descended from
a document Bill Shannon put together at Sun for code in the
older, BSD-derived SunOS 4.x operating system; a few years ago,
another engineer and I took that document, cleaned it up,
updated it to reflect existing practice, reorganized it a bit
to logically flow better, and published it as a man page:
https://illumos.org/man/7/style

There are many things in there that I do not personally like;
mandatory parentheses around the expression in a `return` are
among them, but also the outright ban on `//` comments, macros
over inline functions, and so on.  I hold my nose and follow it
because that's a requirement of the job.  *Shrug*

But sometimes I am very surprised at what my colleagues find
unreadable; recently I wrote a rather large driver for an IP in
our SoC complexes, and among the things that driver does are
allocating physical address space to MMIO.  The internal
function one calls to do such things takes a number of
arguments, including a pointer to an attributes structure, an
address, a size, flags, and so on.  I had neatly grouped the
arguments onto lines so that, for example, the pointer to the
attributes structure was on one line, then a line break and then
the address and size together by themselves on the next line,
etc.  The reviewer (who's been working in this source base for
several decades) found that very difficult to read and asked me
to fill the lines as much as I could, up to the 80-column
maximum (another limit I find silly); ironically, I found that
much more difficult to read.

The point is, "readability" can be subjective.  What one person
finds easy to read may not be so for another.

>And in the example that started this subthread, I probably wouldn't
>have mentioned the parentheses if the poster hadn't been complaining
>about "fluff".

Yeah, that's fair.  The poster seems unnecessarily combative in
a weird way.

	- Dan C.
Technical Details
Message-ID: <11c1t8r$f9b$1@reader2.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
References: <11bpvs7$1e6kc$2@dont-email.me> <11bvqbn$3g0tj$1@dont-email.me> <11c07vf$lhk$1@reader2.panix.com> <11c0kst$3pmvb$2@kst.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.lang.c
Subject: Re: .5 against 0.5f
Date: Fri, 30 Oct 2026 10:58:35 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11c1t8r$f9b$1@reader2.panix.com>
References: <11bpvs7$1e6kc$2@dont-email.me> <11bvqbn$3g0tj$1@dont-email.me> <11c07vf$lhk$1@reader2.panix.com> <11c0kst$3pmvb$2@kst.eternal-september.org>
Injection-Date: Fri, 30 Oct 2026 10:58:35 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="15659"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)