Article View: comp.lang.c
Article #92Re: Real world switch () with the MPS memory pool system!
From: Johann 'Myrkraverk' Oskarsson
Date: Fri, 09 Oct 2026 20:41
Date: Fri, 09 Oct 2026 20:41
77 lines
4817 bytes
4817 bytes
On 10/9/2026 10:30 PM, Stefan Ram wrote: > Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> wrote or quoted: >> So the question here is, do you think this is reasonable C code, and >> would you write something similar yourself? After all, /kind/ is an >> enum, and the compiler might complain if you don't handle all the cases, > > I see no problem with the code after a first quick reading. > > As a matter of style, I might have added a "const" here or there. > However, this is less important for simple small functions. > > The fact that this function is small makes it actually quite > readable. > > A type such as "mps_addr_t" might hide an asterisk. So, "mps *" > might be more readable than "mps_addr_t" because it uses the > language to express the addressness instead of less clear names > and allows the adding of "const"s, as in "mps const * const" > where appropriate. OTOH, sometimes one wants to hide such details, > but then one also would avoid inserting "addr_t" into a name. > > The functions lacks documentation such as can be written using > Doxygen or something. So it's intended semantics are unknown and > we cannot review that aspect. > > Newsgroups: comp.lang.c,comp.lang.misc,comp.lang.lisp > Followup-To: comp.lang.c The type mps_addr_t is from the MPS library, obviously, and I just use the library as the makers -- though now gone -- envisioned. No, there's no documentation. It's explicitly written for a function pointer in the MPS library, which does document its purpose. I don't know about you, but I don't feel the need to document all such functions once I'm starting to know how the library works. Though, it's not a bad practice. Documenting for instance the callback functions in Expat XML, which I'm sure everyone here in comp.lang.c has experimented with, if not used in production from time to time, is quite a good practice; especially when they keep track of where in the XML hierarchy they are with a stack library. I can recommend Loudon's /Mastering Algorithms in C/ stack library for student projects, prototypes, and experiments; but not necessarily pro- duction code. In similar fashion, the renowned Mustache library by Jose Bollo, https://gitlab.com/jobol/mustach needs callbacks; I admit I've not used the newer version 2 yet. And they can be documented similarly with Doxygen. Though I have to say, I quite dislike Doxygen as a product. Too many open source projects have come to write /documented with Doxygen/, but then nothing gets written. So we get all kinds of fancy H.T.M.L. with clickable links and maybe even fancy class diagrams, but nobody bothered to write the documentation a hapless user of the library would like to use. So there is the argument that Doxygen has contributed to a /lack/ of documentation in the open source world, quite directly, by hiding the fact nothing was ever written of the supposed documentation. Of course, we cannot directly associate that social phenomenon to the makers of Doxygen, can we? After all, coders aren't writers, and rather dump code on GitHub, GitLab, or previously, directly on Usenet, F.T.P. and similarly obscure places, without ever writing anything about what it's for, and then be perplexed nobody comments nor seems to use it. Best wishes, and happy documenting your own code! -- Johann | email: invalid -> com | http://www.myrkraverk.com/blog/ I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:; Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Technical Details
Message-ID:
<QjcyS.18589$VDn8.16982@fx14.ams4>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx14.ams4.POSTED!not-for-mailReferences:
<EUBxS.8919$mPXe.2290@fx06.ams4> <code-20261009152721@ram.dialup.fu-berlin.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx14.ams4.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Real world switch () with the MPS memory pool system! Newsgroups: comp.lang.c References: <EUBxS.8919$mPXe.2290@fx06.ams4> <code-20261009152721@ram.dialup.fu-berlin.de> Content-Language: en-US From: Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> Organization: Watcom Pro Ltd. In-Reply-To: <code-20261009152721@ram.dialup.fu-berlin.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 77 Message-ID: <QjcyS.18589$VDn8.16982@fx14.ams4> X-Complaints-To: abuse@easynews.com X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Sat, 10 Oct 2026 04:41:18 +0800 X-Received-Bytes: 4632