Article View: comp.lang.c
Article #683Re: Taming The Switch-Statement
From: Chris M. Thomasson
Date: Thu, 22 Oct 2026 19:46
Date: Thu, 22 Oct 2026 19:46
46 lines
3704 bytes
3704 bytes
On 10/22/2026 9:54 AM, Kaz Kylheku wrote: > 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. > Touche. How about _this vs this_. I just use self and be done with it.
Technical Details
Message-ID:
<11bdp73$15nor$1@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-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> <20261022094427.210@kylheku.com>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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Thu, 22 Oct 2026 12:46:42 -0700 Organization: A noiseless patient Spider Lines: 46 Message-ID: <11bdp73$15nor$1@dont-email.me> 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> <20261022094427.210@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 22 Oct 2026 19:46:43 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1236763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184LQUPuB4if4aAS51B2MjuK+yrY2lfVBc="; posting-host="13291300ea21b2c3e5207e44f50ea877" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:rxGO/yusGgMHxTd3WrwWDEddc3I= sha256:hm09+IzE6NX3xXjdOLeHjpptjeLfkYbHyvcPEXWmn6c= sha1:9aQVAL7SVqdHqRRu1OgKD7mC20c= sha256:kkqTLNC1I9/Zq2LjEpZA6vhC6hGQDNzG+ZpCWsrufgk= Content-Language: en-US In-Reply-To: <20261022094427.210@kylheku.com>