This is why I try to avoid C, as it means handling code from others that shoot in foots
Posted by jpluimers on 2019/08/07
Via [WayBack] Hello, I’m translating some C code to Delphi and found something that surprise me…is it logical that this code compiles ? – Paul TOTH – Google+
Maintaining C means you need to be aware that other people like shooting at foots (yes, that is a grammar error by intent):
#include
#include
void test();
void test2() {
test();
}
void test(char *msg) {
printf("test called '%s' (%d)\n", msg, strlen(msg));
}
void main() {
test2();
}
Of course!? with gcc under Ubuntu the result is
test called 'test' (4)
Code is derived from [Archive.is] git hub user fogleman project Craft search db_worker_start
The thread has some nice comments.
–jeroen






Leave a comment