#include <stdio.h> int main(char* argv[], int argc) { struct V { char buf1[10]; int b; char buf2[10]; } var; void *ptr = &var.b; printf("%d\n", __builtin_object_size(ptr, 0)); printf("%d\n", __builtin_object_size(ptr, 1)); printf("%d\n", __builtin_object_size(ptr, 2)); printf("%d\n", __builtin_object_size(ptr, 3)); printf("%d\n", sizeof(var)); return 0; }
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
The built-in functions described below yield the best results when used together and when optimization is enabled.
$ ./test16416428
$ ./test
16
4
28