Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

Magic, why 1 2?

      
            
                
            
 run  | edit  | history  | help 1

a == b

  by  LabelMinsk, 2 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, 2 years ago




Please log in to post a comment.