Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #174429

Re: bart again (UCX64)

Path csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: bart again (UCX64)
Date Thu, 07 Sep 2023 14:36:03 -0700
Organization None to speak of
Lines 31
Message-ID <875y4l3buk.fsf@nosuchdomain.example.com> (permalink)
References <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com> <20230904092343.829@kylheku.com> <87r0ndu6tf.fsf@bsb.me.uk> <20230904121509.86@kylheku.com> <ud5db8$1k2dj$1@dont-email.me> <878r9l5ym0.fsf@nosuchdomain.example.com> <ud5qka$1lrm2$1@dont-email.me> <874jk95vaz.fsf@nosuchdomain.example.com> <ud7e75$20tag$1@dont-email.me> <ud7hkm$21ds7$1@dont-email.me> <ud7n60$22dof$1@dont-email.me> <ud7qto$22uso$1@dont-email.me> <ud816v$23vpc$1@dont-email.me> <ud83iu$24b2d$1@dont-email.me> <ud855t$24iki$1@dont-email.me> <uda158$2hcdt$1@dont-email.me> <udac0c$2j66m$1@dont-email.me> <udaj7e$2kag1$1@dont-email.me> <udaqli$2lei3$1@dont-email.me> <udc5kl$2uj22$1@dont-email.me> <udca3j$2v7hg$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain
Injection-Info dont-email.me; posting-host="8a8332d09d93cf379db0c937f1be48e4"; logging-data="3301538"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19C2bg3fERPdtHlXtesb6MO"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:zMvPmbykZOCDIjYP+Pnv/6caLVU= sha1:BWrOiMKNn44m3fEgwpWx8fRkFjc=
Xref csiph.com comp.lang.c:174429

Show key headers only | View raw


Bart <bc@freeuk.com> writes:
[...]
> I've already suggested a compiler should return all-zeros as a default
> return value for code that runs into the final '}'. That will provide
> a consistent return value.

That could mask bugs.

    int func(void) {
        if (this) {
            return a_value;
        }
        else if (that) {
            return another_value;
        }
        else if (the_other) {
            return yet_another_value;
        }
    }

Perhaps I simply forgot to write a return statement at the end, either
before the closing } or in an else clause.  Currently, a compiler is not
required to diagnose this, but many will warn about it with the right
options.  If the language stated that falling off the end implicitly
returns "all-zeros" (I won't get into what that means), then the behavior
is well defined and the compiler is unlikely to be able to help.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-05 15:33 +0100
  Re: bart again (UCX64) scott@slp53.sl.home (Scott Lurndal) - 2023-09-05 14:55 +0000
    Re: bart again (UCX64) Bobby Moore <bobbymoore018@gmail.com> - 2023-09-05 08:30 -0700
  Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-05 17:31 +0200
    Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-05 18:06 +0100
      Re: bart again (UCX64) Kaz Kylheku <864-117-4973@kylheku.com> - 2023-09-05 17:54 +0000
      Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-05 20:10 +0200
        Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-05 20:57 +0100
          Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-05 22:37 +0200
            Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-05 22:05 +0100
              Re: bart again (UCX64) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-09-05 15:10 -0700
                Re: bart again (UCX64) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-09-06 22:32 -0700
                Re: bart again (UCX64) Kaz Kylheku <864-117-4973@kylheku.com> - 2023-09-07 06:49 +0000
              Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-06 16:08 +0200
                Re: bart again (UCX64) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-09-06 07:53 -0700
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-06 17:35 +0200
                Re: bart again (UCX64) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-09-06 09:37 -0700
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-06 20:49 +0200
                Re: bart again (UCX64) scott@slp53.sl.home (Scott Lurndal) - 2023-09-06 19:51 +0000
                Re: bart again (UCX64) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-09-06 12:52 -0700
                Re: bart again (UCX64) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-09-07 00:36 +0100
                Re: bart again (UCX64) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-09-06 17:06 -0700
                Re: bart again (UCX64) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-09-06 18:47 -0700
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-07 11:11 +0200
                Re: bart again (UCX64) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-09-07 04:04 -0700
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-07 13:24 +0200
                Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-06 18:13 +0100
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-06 21:17 +0200
                Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-06 22:24 +0100
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-07 11:37 +0200
                Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-07 11:53 +0100
                Re: bart again (UCX64) David Brown <david.brown@hesbynett.no> - 2023-09-07 13:33 +0200
                Re: bart again (UCX64) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-09-07 14:36 -0700
                Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-07 22:59 +0100
                Re: bart again (UCX64) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-09-07 16:58 -0700
                Re: bart again (UCX64) Kaz Kylheku <864-117-4973@kylheku.com> - 2023-09-08 00:35 +0000
          Re: bart again (UCX64) Kaz Kylheku <864-117-4973@kylheku.com> - 2023-09-05 20:41 +0000
          Re: bart again (UCX64) Kaz Kylheku <864-117-4973@kylheku.com> - 2023-09-05 20:47 +0000
          Re: bart again (UCX64) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-09-05 14:07 -0700
            Re: bart again (UCX64) Bart <bc@freeuk.com> - 2023-09-05 22:22 +0100
              Re: bart again (UCX64) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-09-05 15:26 -0700
              Re: bart again (UCX64) Richard Damon <Richard@Damon-Family.org> - 2023-09-05 18:26 -0700
      Re: bart again (UCX64) James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-09-07 23:15 -0400
  Re: bart again (UCX64) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-09-05 13:48 -0700
    Re: bart again (UCX64) Kaz Kylheku <864-117-4973@kylheku.com> - 2023-09-05 21:36 +0000

csiph-web