Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Magic, why 1 2?


            
                
            
 run  | edit  | history  | help 1

a == b

  by  LabelMinsk, 3 years ago


Read the man of realloc, it's basic undefined behavior. a is not valid after realloc if realloc don't return NULL. By the way, it's because the compiler optimize this.

Try:

-Wall -std=c++14 -stdlib=libc++ -O0 -o a.out source_file.cpp

You welcome, bye.

  by  Stargateur, 3 years ago




Please log in to post a comment.