Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Alternatives to C (was Re: Safety of casting from 'long' to 'int') Date: Thu, 14 May 2026 09:55:27 -0700 Organization: A noiseless patient Spider Lines: 52 Message-ID: <868q9mhqww.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10tof8a$b63$1@dont-email.me> <10tp26r$1l93l$21@dont-email.me> <10tpt9j$c3i4$1@dont-email.me> <10tpvqv$ivo$3@reader1.panix.com> <10ttvng$1j579$1@dont-email.me> <10tu082$1irrv$2@kst.eternal-september.org> <10u069d$285sv$1@dont-email.me> <10u0a0m$2a4nr$1@kst.eternal-september.org> <10u0k0k$1l93l$30@dont-email.me> <10u3dka$34b89$6@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 14 May 2026 16:55:30 +0000 (UTC) Injection-Info: dont-email.me; logging-data="579090"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jEEGV3hiX9Uz8tvwgGxywqITl7QkpwKs="; posting-host="d527bc7f7e7e084b0e2324cbe71ceb59" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:wo84q3YaE1NxWO5wrk7VCojpfvg= sha1:mVsZz5cWEo5JTRI0vxGYsIs/QXo= sha256:VG+eKUczOor7TTESHpt+6bKzHxQSHw0T3hLMqnDGwRw= sha1:D7h1SxI3s3jat+mr/qY+h1ugOvU= Xref: csiph.com comp.lang.c:398955 scott@slp53.sl.home (Scott Lurndal) writes: > Janis Papanagnou writes: > >> On 2026-05-13 17:12, Scott Lurndal wrote: >> >>> We use: >>> >>> # if __GNUC__ >= 7 // 'statement attributes' were new with GCC 7.x >>> # if defined(__cplusplus) && (__cplusplus >= 201103L) // C++11 or higher >>> # define XXX_FALLTHROUGH [[gnu::fallthrough]] >>> # else >>> # define XXX_FALLTHROUGH __attribute__ ((fallthrough)) >>> # endif >>> # else // GCC 4.x, 5.x, 6.x, comment only! >>> # define XXX_FALLTHROUGH /* Fall Through */ >>> # endif >>> >>> Where 'XXX' is replaced by the app name. >>> >>> switch (variable) { >>> case cond1: >>> break; >>> case cond: >>> do something >>> XXX_FALLTHROUGH >>> default: >>> do something else >>> } >> >> Just a note aside; couldn't the XXX be automatically concatenated using >> the CPP features? (I seem to recall we've done such things back then.) > > Not sure I understand your question. I used xxx above just > to obscure the name of the proprietary program that includes > the above file. > >> I also wonder about the app-specific variants; wouldn't one version for >> all apps have sufficed? > > There is a need to support gcc4 through gcc14 in that project. We've > subsequently raised the lower limit to gcc7. The project was started > in 2012. If instead you use #define XXX_FALLTHROUGH GOHERE_( __LINE__ ) #define GOHERE_( n ) GOHERE__( n ) #define GOHERE__( n ) goto RIGHT_HYAR_##n; RIGHT_HYAR_##n: and just give 'XXX_FALLTHROUGH;', how are the results? It works fine in my tests.