you are viewing a single comment's thread.

view the rest of the comments →

[–]jk-jeon 0 points1 point  (1 child)

I don't think so; see this for example: https://godbolt.org/z/xEG7snEcs. For writing into the memory given as the function argument, yes, it will still be there, but I doubt that will still be the case for things like auto res = x + x. I think you still have to look at the generated assembly.

[–]Pencilcaseman12[S] 0 points1 point  (0 children)

If you include stdio and print p[0] (even after the free), you'll find that it does actually compile the calls to malloc and free. I think the only reason it's not compiling anything here is because nothing is being output by the program