Pergunta de entrevista da empresa Arista Networks

Why two calls to printf with same parameters were giving completely different results?

Respostas da entrevista

Sigiloso

14 de out. de 2017

Likely the compiler/linker were resolving these calls to slightly different library functions/wrappers.

1

Sigiloso

17 de out. de 2017

The format string and arguments aren't consistent, so the stack is not unwound properly. As the result, the caller's addressing (like %esp + auto variable offset) becomes irrelevant to the actual addresses and gives wrong values.