Article View: comp.lang.c
Article #680Re: Taming The Switch-Statement
From: Kaz Kylheku
Date: Thu, 22 Oct 2026 16:54
Date: Thu, 22 Oct 2026 16:54
47 lines
3466 bytes
3466 bytes
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote: > On 21/10/2026 22:02, Chris M. Thomasson wrote: >> On 10/21/2026 5:17 AM, David Brown wrote: >> [...] >> >> *_t intrudes into POSIX. > > I don't program for POSIX, so I don't care. The same applies to most > code that is used in connection with FreeRTOS, or LWIP. (Of course > there will be some overlap - bits of code that are intended to run on a > microcontroller but tested with code running native on a PC.) > > I don't know if the "_t" convention for type identifiers started with > POSIX, but it has certainly far outgrown POSIX. And I think the smart > folks behind POSIX know this, and will not assume that just because they > pick a new type name ending in _t, it will not conflict with some user > code. As C doesn't have namespaces, there is always a risk of > conflicting names - you just have to try to avoid clashes in things you > are likely to see. These namespace declarations are really just a "heads up". POSIX isn't saying, don't have an identifier ending in _t in a namespace shared by typedefs. Rather, it is saying that new typedefs appearing in POSIX will be in that namespace. Consider this argument: whenever POSIX or ISO C introduces a new public identifier, it's necessarily going to start with "a", or else if not, then with "b", or else with "c", ... or else with "z" or perhaps the underscore. That doesn't mean you stop using identifiers in programming. "nullptr" is now a keyword, previously a valid identifier not in any proclaimed reserved namespace. Progrems which used it have to be changed to work with the newer language. Avoiding proclaimed namespaces will not protect you from clashes; only from clashes that would occur in those namespaces. Some spaces like _t are too attractive to avoid, because they are tied to an important, popular convention that everyone understands, and the benefits outweigh the unrealized risk of a future clash. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca
Technical Details
Message-ID:
<20261022094427.210@kylheku.com>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-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <11b6224$2ejik$1@dont-email.me> <11b774o$2m8c9$3@dont-email.me> <11b7k22$2v8e5$1@dont-email.me> <11b8f5h$67l$1@reader2.panix.com> <11baah2$3te3v$1@dont-email.me> <11bb5ou$8nfg$2@dont-email.me> <11bcc4o$jt81$1@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!.POSTED!not-for-mail From: Kaz Kylheku <046-301-5902@kylheku.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Thu, 22 Oct 2026 16:54:45 -0000 (UTC) Organization: A noiseless patient Spider Lines: 47 Message-ID: <20261022094427.210@kylheku.com> References: <119qf6l$2rmg3$1@dont-email.me> <11b6224$2ejik$1@dont-email.me> <11b774o$2m8c9$3@dont-email.me> <11b7k22$2v8e5$1@dont-email.me> <11b8f5h$67l$1@reader2.panix.com> <11baah2$3te3v$1@dont-email.me> <11bb5ou$8nfg$2@dont-email.me> <11bcc4o$jt81$1@dont-email.me> Injection-Date: Thu, 22 Oct 2026 16:54:46 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1089112"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cStjfXLTY2hjwOJcnM83Tr4iYVI9Xcv4="; posting-host="1cad69a6b5b45f8923c6c28fc75c62ba" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:u8vpKZ1MrVi57qOg+04jesa1n84= sha256:lnlyM36tZ6BuCusMy4d8slIp0TFXAjbJAzn1VDPQhzs= sha1:LruXPtgeu5Eh8c7+EG7zPkKkLOk= sha256:qr0JSLLoJKSo/aRX3ehe7hveXH3S1HUJeu2lfnWkpto=