3 ms·
GCC 5 already does that for you (and more), since malloc/free are C standard library functions: #include <stdlib.h> int main() { free(NULL);
by the_why_of_y 11y ago
GCC 5 already does that for you (and more), since malloc/free are C standard library functions:
#include <stdlib.h>
int main()
{
free(NULL);
char *foo = malloc(42);
free(foo);
}
gcc -O1 compiles it to:
00000000004004f6 <main>:
4004f6: b8 00 00 00 00 mov $0x0,%eax
4004fb: c3 retq
4004fc: 0f 1f 40 00 nopl 0x0(%rax)