6 ms·
What do lines 7-21 do?
by dc-programmer 3y ago
What do lines 7-21 do?
- rkaehn 3y agoThe library is an "stb-style" header-only library, so the header has two modes: when you define CR_TASK_IMPL, it includes the implementation (starting from line 20), otherwise it just includes declarations (the first 19 lines). The implementation should only be included in one translation unit, but the declarations can be included in multiple units.
- dc-programmer 3y agoAh, sorry I meant in test.c. I was nodding off when I wrote that comment
- salamander014 3y agoHistorically, C compilers attempted to build the list of all symbols in one pass of the files. Sometimes, functions may call other functions in the same code file. This required that functions be declared before they are referenced so C knew it existed. You can also see this on lines 84-92.