// Prevent the compiler from optimizing out the __cxa_atexit call. void (*volatile g_pdtor_func)(void*) = dtor_func;
int main(int argc, char* argv[]) { auto usage = [&argv]() {
fprintf(stderr, "usage: %s COUNT MODE\n", argv[0]);
fprintf(stderr, "MODE is one of '_Exit' or 'exit'.\n"); exit(1);
};
if (argc != 3) usage();
int count = atoi(argv[1]);
// Two modes: "_Exit" ==> exit early w/o calling dtors, "exit" ==> call dtors on exit.
std::string mode = argv[2]; if (mode != "_Exit" && mode != "exit") usage();
for (int i = 0; i < count; ++i) {
__cxa_atexit(g_pdtor_func, nullptr, &__dso_handle);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.