🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #528

Re: Taming The Switch-Statement

#528
From: Dan Cross
Date: Sun, 18 Oct 2026 22:33
50 lines
3067 bytes
In article <11b285v$121v2$2@dont-email.me>,
David Brown  <david.brown@hesbynett.no> wrote:
>On 17/10/2026 01:29, Janis Papanagnou wrote:
>> On 2026-10-17 00:00, Keith Thompson wrote:
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>> [...]
>>>>> There's a proposal for C2y to use goto labels as loop names, and a
>>>>> competing one to define a new syntax like "for NAME (;;)" :
>>>>> [...]
>>>>
>>>> I'm not particularly a fan of multi-level break/continue.  But if
>>>> we're going to have one of these, the second ("for NAME (;;)") is
>>>> unquestionably better.
>>>
>>> Unquestionably?  Why?
>> 
>> Why would one question an opinion? ;-)
>
>Time didn't word it as a personal opinion - he made it clear that he 
>doesn't think anyone else could have a different opinion.

Tim often makes it sound as though he believes that his opinions
are facts.

>> As far as I recall, in "C", the name of the function was often put
>> separately (first in the line) to have an easy method to find its
>> declaration by simple "grep ^fname". (With any sophisticated editor
>> this might be a weak argument, though.)
>
>I think it was popularised with a shortcut in emacs.

No, it was `grep`.  The convention originated on Unix, but well
before there was a version of Emacs in widespread use on those
systems; most Unix programmers were using `ed` at the time, and
`vi` was still a few years away; `ctags` was not a thing yet.

Recall that early versions of C defaulted to `int` as a return
type if otherwise unspecified; there was no `void`, so if a
programmer had no intention of returning anything at all, they
would just omit the return type and the `return` statement.  The
result was that there were many functions that declared no
return type, and just started with the function at the beginning
of the line; it was natural to use `grep ^name` to look for
those, and it was sufficiently useful that the convention stuck
even as we gained both more powerful editors and more stricter
versions of C.

	- Dan C.
Technical Details
Message-ID: <11b3hfo$8vk$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: <119qf6l$2rmg3$1@dont-email.me> <11au6pr$3mdne$1@kst.eternal-september.org> <11auc0s$206gh$3@dont-email.me> <11b285v$121v2$2@dont-email.me>

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: Taming The Switch-Statement
Date: Sun, 18 Oct 2026 22:33:28 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11b3hfo$8vk$1@reader2.panix.com>
References: <119qf6l$2rmg3$1@dont-email.me> <11au6pr$3mdne$1@kst.eternal-september.org> <11auc0s$206gh$3@dont-email.me> <11b285v$121v2$2@dont-email.me>
Injection-Date: Sun, 18 Oct 2026 22:33:28 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="9204"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)