Boost logo

Boost Users :

Subject: Re: [Boost-users] [context] How to set stack pointer in a platform-independent way?
From: Nat Goodspeed (nat_at_[hidden])
Date: 2014-09-20 13:48:19


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?


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