|
|
|
|
|
by bobmcnamara
413 days ago
|
|
The only hack I could think of is having the compiler front end generate calls to different functions based on the content of the format string, similar to how some compilers replace memset with a 32-bit memset based on the type of the destination pointer And it all falls apart as soon as a format string cannot be known at compile time. |
|
Compilers do that, at least for the simple case of constant strings; gcc can compile a printf call as puts. See https://stackoverflow.com/questions/60080021/compiler-change...