Better HN
topnewbestaskshowjobs
Log inSign up

epilk

9 karma · joined Aug 30, 2017 (9y ago) · 2 submissions

Submissions

comment 8y ago · link · parent

How else will the project know that the major changes will be maintained? Having code in a project without an owner will just lead to bugs and bit rot.

comment 8y ago · link · parent

I also encountered the last problem, it can be handled pretty easily with __attribute__((constructor)):

  void (*_test_functions[NTEST_FUNCTIONS])(void);
  int _test_function_idx;

  #define TEST_FUNCTION(fname) \
    void fname(void); \
    __attribute__((constructor)) static void _init_ ## fname (void) { \
      _test_functions[_test_functions_idx++] = fname; \
    } \
    void fname()

  TEST_FUNCTION(test_foo_bar) {
    assert(foo_bar == 0);
  }