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


Groups > comp.lang.c > #35439

Re: Baby X

From Ike Naar <ike@iceland.freeshell.org>
Newsgroups comp.lang.c
Subject Re: Baby X
Date 2013-08-18 20:15 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfsl12aq8.klg.ike@iceland.freeshell.org> (permalink)
References (14 earlier) <ku8fjm$juj$1@dont-email.me> <4bQNt.683$nK2.441@en-nntp-11.dc1.easynews.com> <lntxiwlz3c.fsf@nuthaus.mib.org> <MPG.2c79fbfac4cd825d7@news.eternal-september.org> <kur51b$rkm$1@dont-email.me>

Show all headers | View raw


On 2013-08-18, James Kuyper <jameskuyper@verizon.net> wrote:
> On 08/18/2013 01:31 AM, Philip Lantz wrote:
> ...
>> Unfortunately, this would require a diagnostic for the following:
>> 
>>     int func(void) {
>>         if (cond) {
>>             cleanup_and_exit(); // unconditionally calls exit()
>>         }
>>         else {
>>             return 0;
>>         }
>>    }
>>
>> unless you also add a noreturn attribute.
>
> Too late - _Noreturn was added in C2011. You can use noreturn as an
> equivalent, so long as you #include <stdnoreturn.h> first.

But with different semantics.

_Noreturn in C2011 applies to an entire function and indicates
that the function shall never return to its caller.
If the _Noreturn specifier were used with func as given above, the
behaviour would be undefined if the flow would reach the 'else'
branch, returning 0. Also, the standard recommends that the
implementation produce a diagnostic message for the function
since it appears to be capable to return to its caller.

Philip was apparently looking for a noreturn attribute that would
prevent a diagnostic for not returning a value in the 'if (cond)'
branch.

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


Thread

Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 04:38 -0700
  Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-07 07:19 +1200
    Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 12:38 -0700
      Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-07 07:49 +1200
        Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 15:17 -0700
          Re: Baby X Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-07 00:29 +0100
          Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-07 13:45 +1200
            Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-07 03:22 -0700
              Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-07 06:36 -0400
        Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-10 20:04 +0100
      Re: Baby X Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-09 17:28 +0000
        Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-09 12:43 -0700
          Re: Baby X glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-09 20:01 +0000
            [OT] Re: Baby X Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-08-09 16:30 -0400
            Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-09 14:12 -0700
              Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-10 20:11 +0100
                Re: Baby X Robert Wessel <robertwessel2@yahoo.com> - 2013-08-10 14:41 -0500
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-10 21:34 -0400
                Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-11 11:02 +0100
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-11 12:54 -0400
                Re: Baby X Richard Damon <Richard@Damon-Family.org> - 2013-08-11 13:51 -0400
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-11 14:10 -0400
                Re: Baby X Richard Damon <Richard@Damon-Family.org> - 2013-08-11 14:43 -0400
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-11 14:03 -0700
                Re: Baby X Richard Damon <Richard@Damon-Family.org> - 2013-08-11 17:57 -0400
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-11 18:37 -0700
                Re: Baby X glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-12 04:12 +0000
                Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-12 07:42 +0100
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-12 09:10 -0700
                Re: Baby X Philip Lantz <prl@canterey.us> - 2013-08-17 22:31 -0700
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-18 14:50 -0400
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-18 20:15 +0000
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-18 16:30 -0400
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-18 21:03 +0000
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-20 13:09 +1200
                Re: Baby X Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-20 12:24 +0300
                Re: Baby X Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-20 13:11 +0100
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-20 08:33 -0700
                Re: Baby X Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-23 11:32 +0300
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-21 08:01 +1200
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-11 13:57 -0700
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-10 21:29 -0400
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-10 22:04 -0700
          Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-09 20:16 +0000
            Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-09 15:29 -0700
              Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-10 05:45 +0000
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-10 03:18 -0700
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-10 17:02 +0000
  Re: Baby X Ike Naar <ike@ukato.freeshell.org> - 2013-08-06 21:00 +0000
    Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 15:07 -0700

csiph-web