🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #638

Re: Taming The Switch-Statement

#638
From: Dan Cross
Date: Wed, 21 Oct 2026 11:26
26 lines
1830 bytes
In article <11ba78m$3peq3$3@dont-email.me>,
David Brown  <david.brown@hesbynett.no> wrote:
>On 21/10/2026 03:04, bart wrote:
>> [snip]
>> Anyway with some tweaks in place, using the struct typedef and using an 
>> inline function pointer type, it would look like this:
>> 
>>   signed char
>>      dns_gethostbyname(
>>        const char *hostname,
>>        IP_addr    *addr,
>>        void      (*found)(char*, IP_addr*, void *),
>>        void       *arg
>>     );
>> 
>> In this form, it is not wildly different from your short version.
>
>Not wildly different, just worse by counter-productively removing the 
>abstractions and appropriate type names, and uselessly cluttering the 
>declaration with unnecessary detail.

...and also removing the `const` qualifiers on the first two
pointer arguments to `found`.  

	- Dan C.
Technical Details
Message-ID: <11ba7hv$4sh$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> <11b7ogt$2m8c9$5@dont-email.me> <11b933e$3h3d0$1@dont-email.me> <11ba78m$3peq3$3@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: Wed, 21 Oct 2026 11:26:55 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11ba7hv$4sh$1@reader2.panix.com>
References: <119qf6l$2rmg3$1@dont-email.me> <11b7ogt$2m8c9$5@dont-email.me> <11b933e$3h3d0$1@dont-email.me> <11ba78m$3peq3$3@dont-email.me>
Injection-Date: Wed, 21 Oct 2026 11:26:55 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="5009"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)