Article View: comp.lang.c
Article #765Re: Taming The Switch-Statement
From: Chris M. Thomasson
Date: Sun, 25 Oct 2026 20:54
Date: Sun, 25 Oct 2026 20:54
102 lines
5645 bytes
5645 bytes
On 10/25/2026 2:51 AM, David Brown wrote: > On 25/10/2026 05:42, Chris M. Thomasson wrote: >> On 10/24/2026 3:58 AM, David Brown wrote: >>> On 23/10/2026 23:21, Chris M. Thomasson wrote: >>>> On 10/23/2026 12:37 AM, David Brown wrote: >>>>> On 22/10/2026 21:46, Chris M. Thomasson wrote: >>>>>> 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.) >>>>>>>> >>>>> >>>>>>> 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. >>>>> >>>>> Imagine, just for a moment, that the rest of us are not privy to >>>>> the jumble of thoughts and ideas that jump around in your head. I >>>>> don't have the context of what you are thinking about. So I have >>>>> no idea what you mean by this. >>>>> >>>>> Instead of posting random out-of-context snippets of thought, >>>>> either write posts that say what you are talking about, or don't >>>>> bother. (And do /not/ imagine that posting reams of unconnected >>>>> code is a useful alternative.) >>>>> >>>>> If you are trying to say something about avoiding C++ keywords when >>>>> picking identifiers in C coding, say that. If you are trying to >>>>> say something about naming conventions for C++ class members, feel >>>>> free to talk about that too - in comp.lang.c++. If you are trying >>>>> to say something else, say it. Or drop it, if you prefer. >>>>> >>>> >>>> Or, Well, >>>> >>>> _this >>>> >>>> vs >>>> >>>> this_ >>>> >>>> Are they both legal? >>> >>> What do you mean, "legal" ? Identifiers in C can start with any >>> letter (including most Unicode "letters") or underscore, or any other >>> implementation-defined characters. Subsequent characters can be any >>> of these or a normal digit from the basic source character set. >>> >>> The only identifiers you may not use are ones that match keywords. >>> >>> There are various patterns that are "reserved", depending on header >>> usage, but using them is still "legal". The main ones to avoid are >>> identifiers starting with two underscores, or one underscore and a >>> capital letter. >>> >>>> >>>> I like self. >>>> >>>> void foo(struct foo* const self); >>>> >>>> vs >>>> >>>> void foo(struct foo* const _this); >>>> void foo(struct foo* const this); >>>> void foo(struct foo* const this_); >>>> >>>> ? For some reason I do not want to use this in C. >>>> >>> >>> Use whichever you like. I would personally avoid using an identifier >>> in C that matches a keyword (or "contextual keyword") in C++, to make >>> it easier to re-use the same code in C++. But you don't have to do >>> the same. >>> >> >> _this good, _This bad? > > You figure it out. I'm done trying to understand your silly little > posts and silly little questions, and then spoon-feed you basics about > the C language. > I already know, just like *_t can be bad. Just shooting the breeze. No need to get pissed off.
Technical Details
Message-ID:
<11blqa7$3v8r7$2@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> <11bdp73$15nor$1@dont-email.me> <11bf2s9$1eo7q$2@dont-email.me> <11bgj4c$265sc$2@dont-email.me> <11bi2vp$2jjto$3@dont-email.me> <11bk1cd$3al3q$1@dont-email.me> <11bkjfc$3fber$2@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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Sun, 25 Oct 2026 13:54:31 -0700 Organization: A noiseless patient Spider Lines: 102 Message-ID: <11blqa7$3v8r7$2@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> <11bdp73$15nor$1@dont-email.me> <11bf2s9$1eo7q$2@dont-email.me> <11bgj4c$265sc$2@dont-email.me> <11bi2vp$2jjto$3@dont-email.me> <11bk1cd$3al3q$1@dont-email.me> <11bkjfc$3fber$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 25 Oct 2026 20:54:32 +0000 (UTC) Injection-Info: dont-email.me; logging-data="4170599"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/KgS9vL3pqrRhC1FpS2odcV030Oemlvds="; posting-host="792908fec4aa45dbc14a04382b76f62a" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:kew1gCMMpe0qievM6fNTxxZ7t28= sha256:dfJ8NdnuN70u7nrf8ByVHtUKWEn3DAFTgM+3n/CDNnM= sha1:4UXcB408cLst1MadpRJLM3TTtAI= sha256:GMmc55jVB6k8UoTuSZOh72C/hvCBmmKcg6Mjy61KFfw= In-Reply-To: <11bkjfc$3fber$2@dont-email.me> Content-Language: en-US