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


Groups > comp.lang.c > #70971

Re: why "int s = setjmp(env)" fails?

From Nobody <nobody@nowhere.invalid>
Newsgroups comp.lang.c
Subject Re: why "int s = setjmp(env)" fails?
Date 2015-09-20 10:53 +0100
Organization A noiseless patient Spider
Message-ID <pan.2015.09.20.09.53.46.185000@nowhere.invalid> (permalink)
References <d8e6c449-3aad-405e-b8a2-5fa73ee6a9a3@googlegroups.com>

Show all headers | View raw


On Sat, 19 Sep 2015 21:59:05 -0700, i wrote:

> while(setjmp(env)) will succeed,  (1)
> 
> however,
> 
> volatile int s = setjmp(env) will fail.  (2)
> 
> 
> what's the technical complexity/difficulty that hinders (2) ?

7.13.1.1 says:

[#4] An invocation of the setjmp macro shall appear only
in one of the following contexts:

 --  the entire controlling expression of a selection or
     iteration statement;
     
 --  one operand of a relational or equality operator with the
     other operand an integer constant expression, with the
     resulting expression being the entire controlling
     expression of a selection or iteration statement;
     
 --  the operand of a unary ! operator with the resulting
     expression being the entire controlling expression of a
     selection or iteration statement; or
     
 --  the entire expression of an expression statement
     (possibly cast to void).

[#5] If the invocation appears in any other context, the
behavior is undefined.

(1) is covered by the first clause of #4. (2) comes under #5.

> AFAIK, (2) is still a simple statment.

(2) isn't any kind of statement, it's a declaration.

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


Thread

why "int s = setjmp(env)" fails? i@introo.me - 2015-09-19 21:59 -0700
  Re: why "int s = setjmp(env)" fails? Nobody <nobody@nowhere.invalid> - 2015-09-20 10:53 +0100
  Re: why "int s = setjmp(env)" fails? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-20 07:47 -0400
    Re: why "int s = setjmp(env)" fails? supercat@casperkitty.com - 2015-09-21 08:51 -0700
      Re: why "int s = setjmp(env)" fails? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-21 12:52 -0400
        Re: why "int s = setjmp(env)" fails? supercat@casperkitty.com - 2015-09-21 11:44 -0700
          Re: why "int s = setjmp(env)" fails? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-21 15:52 -0400
            Re: why "int s = setjmp(env)" fails? supercat@casperkitty.com - 2015-09-22 11:51 -0700
        Re: why "int s = setjmp(env)" fails? Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-26 17:06 -0700
        Re: why "int s = setjmp(env)" fails? Paul N <gw7rib@aol.com> - 2015-09-28 14:28 -0700
  Re: why "int s = setjmp(env)" fails? Keith Thompson <kst-u@mib.org> - 2015-09-20 07:33 -0700
  Re: why "int s = setjmp(env)" fails? James Kuyper <jameskuyper@verizon.net> - 2015-09-20 11:11 -0400

csiph-web