Article View: comp.lang.c
Article #673Re: Taming The Switch-Statement
From: Dan Cross
Date: Thu, 22 Oct 2026 12:56
Date: Thu, 22 Oct 2026 12:56
42 lines
2869 bytes
2869 bytes
In article <11bcc4o$jt81$1@dont-email.me>, 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. It definitely predates POSIX. `typdef` appears to have come into the language with "Typesetter C", which first shipped in 7th Edition research Unix, and 7th Ed had types ending in `_t`; so 1979 or thereabouts. For instance, `daddr_t`, `time_t`, and `caddr_t` to represent disk block addresses, times, and generic addresses, respectively. Curiously, `size_t` isn't there yet, and appears to arrive in 3bsd (also 1979, but based on 32/V), where it is sized (it's just a typedef for `int`). `size_t` makes it back into Research Unix with the 8th Edition, based on 4BSD; probably 4.1. It is signed in 8th Ed, and is a typedef for `long`. My notes put it into AT&T Unix with System V Release 3, where it is unsigned. POSIX started in 1984, building on work done by /usr/group, and the first issue of POSIX was released in 1988. Anyway, the point is that the `_t` convention predates POSIX (and ANSI C) by about a decade. - Dan C.
Technical Details
Message-ID:
<11bd15t$6dj$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-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <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!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: Thu, 22 Oct 2026 12:56:29 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <11bd15t$6dj$1@reader2.panix.com> References: <119qf6l$2rmg3$1@dont-email.me> <11baah2$3te3v$1@dont-email.me> <11bb5ou$8nfg$2@dont-email.me> <11bcc4o$jt81$1@dont-email.me> Injection-Date: Thu, 22 Oct 2026 12:56:29 -0000 (UTC) Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="6579"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross)