5 ms·
That runs at class load time, not at library/executable load time as c++ static constructors or __attribute__((constructor)) does. So no, that's not equivalent
by kllrnohj 4y ago
That runs at class load time, not at library/executable load time as c++ static constructors or __attribute__((constructor)) does.
So no, that's not equivalent. Not even close. This is why you see things in Java that scan through loaded jars looking for all classes with attributes to just speculatively load. To recreate what c++ has natively & C has with a broadly supported extension.