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


Groups > comp.lang.c++ > #14947

Re: constepxr | Isn't this a constant expression?

From Miles Bader <miles@gnu.org>
Newsgroups comp.lang.c++
Subject Re: constepxr | Isn't this a constant expression?
Date 2012-03-16 09:46 +0900
Message-ID <874ntpl6ea.fsf@catnip.gol.com> (permalink)
References <b673c645-fdbc-439d-8371-3fa938835798@ud10g2000pbc.googlegroups.com> <14420784.9.1331707952189.JavaMail.geo-discussion-forums@vbuf25>

Show all headers | View raw


Johannes Schaub - litb <schaub.johannes@googlemail.com> writes:
> The address of local nonstatic variables are not a constant expression. 

I dunno what the standard says, but his confusion seems understandable
to me.

After all, he's not taking the address of a random local variable, but
of a _constexpr_ local variable, and I think the most natural way of
thinking about such a thing is "local in scope but global in extent,"
exactly like a local static variable.

The idea of a variable with a value explicitly fixed at compile-time,
but an address that changes at runtime seems just sort of weird...

-miles

-- 
Friendship, n. A ship big enough to carry two in fair weather, but only one
in foul.

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


Thread

constepxr | Isn't this a constant expression? Samkit Jain <samkit.feeds@gmail.com> - 2012-03-11 03:40 -0700
  Re: constepxr | Isn't this a constant expression? darylew@gmail.com - 2012-03-12 06:22 -0700
  constepxr | Isn't this a constant expression? Johannes Schaub - litb <schaub.johannes@googlemail.com> - 2012-03-13 23:52 -0700
    Re: constepxr | Isn't this a constant expression? 88888 Dihedral <dihedral88888@googlemail.com> - 2012-03-14 20:03 -0700
      Re: constepxr | Isn't this a constant expression? Samkit Jain <samkit.feeds@gmail.com> - 2012-03-15 10:04 -0700
        Re: constepxr | Isn't this a constant expression? Johannes Schaub <schaub.johannes@googlemail.com> - 2012-03-16 23:16 +0100
          Re: constepxr | Isn't this a constant expression? Samkit Jain <samkit.feeds@gmail.com> - 2012-03-18 08:09 -0700
    Re: constepxr | Isn't this a constant expression? Miles Bader <miles@gnu.org> - 2012-03-16 09:46 +0900

csiph-web