🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #635

Re: Taming The Switch-Statement

#635
From: David Brown
Date: Wed, 21 Oct 2026 10:45
32 lines
2967 bytes
On 21/10/2026 02:05, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
> [...]
>> Without typedef's, that function signature would be something like :
>>
>> signed char dns_gethostbyname(const char *hostname, struct ip_addr
>> 	*addr, void (*found)(const char *name,	const struct ip_addr
>> 	*ipaddr, void *callback_arg), void *callback_arg);
> 
> I might write that as:
> 
>      signed char dns_gethostbyname(
>          const char *hostname,
>          struct ip_addr *addr,
>          void (*found)(
>              const char *name,
>              const struct ip_addr *ipaddr,
>              void *callback_arg
>          ),
>          void *callback_arg
>      );
> 
> so the indentation and structure reflects the semantics.  I find
> that much clearer than your version.  (I'm not commenting on the
> merits of typedefs.)
> 

Certainly the indentation makes the unpleasant non-typedef'ed version 
clearer.  And /if/ I had to write that function signature without 
typedefs, I would structure it like you had - but I can't think of any 
reason I would ever have to do so.
Technical Details
Message-ID: <11ba54b$3peq3$2@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> <11arjmc$2qid7$1@dont-email.me> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me> <11b2a6d$131h6$1@dont-email.me> <11b2hr6$15thq$1@dont-email.me> <11b2l06$16mof$1@dont-email.me> <11b2qv0$19h68$1@dont-email.me> <11b35gt$1cn63$2@dont-email.me> <11b557o$1kr9u$1@dont-email.me> <11b56uo$1q18k$5@dont-email.me> <11b6224$2ejik$1@dont-email.me> <11b774o$2m8c9$3@dont-email.me> <11b7k22$2v8e5$1@dont-email.me> <11b7ogt$2m8c9$5@dont-email.me> <11b8vl0$3g2gf$1@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!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Wed, 21 Oct 2026 12:45:31 +0200
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <11ba54b$3peq3$2@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me>
 <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me>
 <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me>
 <11b2a6d$131h6$1@dont-email.me> <11b2hr6$15thq$1@dont-email.me>
 <11b2l06$16mof$1@dont-email.me> <11b2qv0$19h68$1@dont-email.me>
 <11b35gt$1cn63$2@dont-email.me> <11b557o$1kr9u$1@dont-email.me>
 <11b56uo$1q18k$5@dont-email.me> <11b6224$2ejik$1@dont-email.me>
 <11b774o$2m8c9$3@dont-email.me> <11b7k22$2v8e5$1@dont-email.me>
 <11b7ogt$2m8c9$5@dont-email.me> <11b8vl0$3g2gf$1@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Oct 2026 10:45:32 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3980099"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/H4sprLnoup53LlusAUDqEZBFyBAeMKOw="; posting-host="f78456a6491f23b3f53847b5a3287905"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:FAE9dwZ8LAlP0qhIETsFPrUD3+0= sha256:H3hQJTiG+oRN9gM33szm0YBz4uEcBZ4SYmi7WNaVdkQ=
	sha1:46tItWPyr58R5l0beX9wGPGO+bs= sha256:SsaDywKXf6UOa5gUSqM7RWB8KlftOQcCkUI3ZP+cesU=
In-Reply-To: <11b8vl0$3g2gf$1@kst.eternal-september.org>
Content-Language: en-GB, nb-NO