🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #623

Re: Taming The Switch-Statement

#623
From: Keith Thompson
Date: Wed, 21 Oct 2026 00:05
28 lines
2590 bytes
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.)

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID: <11b8vl0$3g2gf$1@kst.eternal-september.org>
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!kst.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>

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!kst.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Tue, 20 Oct 2026 17:05:49 -0700
Organization: None to speak of
Lines: 28
Message-ID: <11b8vl0$3g2gf$1@kst.eternal-september.org>
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>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Wed, 21 Oct 2026 00:05:54 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="3672591"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19eDuJ/iv1olpdgQgoutabZ"; posting-host="e330dd7faf054fe4ae34cec694f6f43b"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:mNW40EHK9XQ9j4SGm8RWfWsfLoI= sha256:OXMqjXrF6xQRipU+Esh8c2LKI04g/HOA7qB45g8TW80=
	sha1:WwTVbQN7LO8RIjTD06MaagClOlQ= sha256:fIWDoXAQiwdfhK8I/tpg65E8XGJ6nqBKftMadI+2X58=