|
Boost Users : |
Subject: Re: [Boost-users] [context] How to set stack pointer in a platform-independent way?
From: TONGARI J (tongari95_at_[hidden])
Date: 2014-09-21 01:06:59
2014-09-21 1:48 GMT+08:00 Nat Goodspeed <nat_at_[hidden]>:
> On Sat, Sep 20, 2014 at 3:20 AM, TONGARI J <tongari95_at_[hidden]> wrote:
>
> > I guess something like below should work?
> >
> > #include <iostream>
> >
> > __attribute__((noinline)) bool is_upward_test(char* a)
> > {
> > char b[32];
> > return a < b;
> > }
> >
> > bool is_upward()
> > {
> > char a[32];
> > return is_upward_test(a);
> > }
> >
> > int main(int argc, char** argv) {
> > std::cout << is_upward();
> > return 0;
> > }
>
> Doesn't the standard say pointer comparisons are only defined between
> pointers into the same container? Therefore wouldn't the above be UB?
>
o_O!? That would be scary, do you really mean pointer or iterator? Where's
the paragraph?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net