🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #619

Re: Taming The Switch-Statement

#619
From: bart
Date: Tue, 20 Oct 2026 22:43
60 lines
3311 bytes
On 20/10/2026 22:44, Dan Cross wrote:
> In article <11b8j17$3btus$1@dont-email.me>, bart  <bc@freeuk.com> wrote:
>> On 20/10/2026 20:24, Dan Cross wrote:
>>> In article <11b7k22$2v8e5$1@dont-email.me>, bart  <bc@freeuk.com> wrote:
>>
>>> The point is that the name you chose is meaningless to anyone
>>> other than you.  What's a PCL?  Phase Control Line?  Printer
>>> Command Language?  Photon Compressor Loop?
>>
>> Within the context of that application then it would be clear. You're
>> just being overly hostile.
> 
> Not really.  You are, I presume, posting that code to try and
> make some kind of point about how "readable" it is.  But it's
> not readable unless you already know what it does.

What it does not relevant. This is simply defining an array of T. But 
because T happens to be a function pointer, DB insists that an alias 
must be created, and a new name invented.

Why? Probably because in C, the syntax for function pointers gets hairy.

> On the other hand, the code David posted _is_ readable, because
> it uses the language to encode domain-specific information into
> type names.

Maybe we should create aliases for function signatures more often then, 
then we can encode that extra info.

So that instead of, for example:

     void SomeFunc(int x, int y) {printf("%d %d\n", x, y);}

you do:

     typedef void Take2Ints(int x, int y);

     Take2Ints SomeFunc {printf("%d %d\n", x, y);}

If you have a suite of functions sharing the signature, then it might be 
a good idea. But funnily enough, you never see this being done.

(I don't know if this is legal C; but it works fine with my compiler:

   c:\m>type fred.c
   #include <stdio.h>

   typedef void Take2Ints(int x, int y);

   Take2Ints SomeFunc{printf("%d %d\n", x, y);}

   int main(void) { SomeFunc(10, 20); }

   c:\m>bcc -r -q fred
   10 20

)

> Yeah, you really just don't get it.
One of us doesn't get it.
Technical Details
Message-ID: <11b8qqg$3ejlp$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11b7k22$2v8e5$1@dont-email.me> <11b8f5h$67l$1@reader2.panix.com> <11b8j17$3btus$1@dont-email.me> <11b8nc4$9aq$1@reader2.panix.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Tue, 20 Oct 2026 23:43:29 +0100
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <11b8qqg$3ejlp$1@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <11b7k22$2v8e5$1@dont-email.me>
 <11b8f5h$67l$1@reader2.panix.com> <11b8j17$3btus$1@dont-email.me>
 <11b8nc4$9aq$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 20 Oct 2026 22:43:29 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3624633"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19iqlnTsZN/qtymU61ivIOj"; posting-host="7c142682e3246f1a229ef2ca48617714"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:3JgGX9gQeMwh4VOti6368b4vu4w= sha256:2TRcpXXegrSEeWRl/bgtEw1WwsfQ/wW3/kA/XjK72y8=
	sha1:eNV9xELvXFOf+3zb2Lr4CjHqvIA= sha256:ZVTH0YJwHggblIOITQxy2gKWNKH2/KMq2bhF0RrYoOY=
Content-Language: en-GB
In-Reply-To: <11b8nc4$9aq$1@reader2.panix.com>