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

Magic, why 1 2?

 run  | edit  | history  | help 0

a == b

  by  LabelMinsk, 6 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.


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

You welcome, bye.

  by  Stargateur, 6 years ago

Please log in to post a comment.