23 karma · joined Mar 8, 2019 (7y ago) · 18 submissions
comment 1mo ago · link · parent
// Create a stack-allocated argv from N args gcc, clang, tcc, mingw, msvc, etc
// argc is always correct, for portability argv has a dummy element when argc==0
// This avoids problematic 0-length compound literal arrays.
#define _ARG_CV(type, ...) _ARG_CV1(((type []){0, __VA_ARGS__}))
#define _ARG_CV1(array) _ALEN(array) - 1, array + (_ALEN(array) > 1)
#define _ALEN(array) sizeof array / sizeof *array
Then it's just: #define sum(...) sum(_ARG_CV(int, __VA_ARGS__))comment 2y ago · link · parent
The responsibility was 100% his because of "an unsafe lane change".
comment 3y ago · link · parent
I would, however, love to send my DNA to a company if they could provide the results without knowing any information about me whatsoever. For instance: I would be more than willing to buy the kit with cash and send it back with a burner email. Has anyone heard of such a service?
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 4y ago · link · parent
Why bother? Because I can then easily add a few extra structs to the beginning of the (contiguously-allocated) linked-list without having to reallocate the whole thing.
Sure, pointer chasing with separately allocated structs is "slow", but I haven't yet measured to see if it's any different when (almost all) items are contiguous.
If you would... - what sort of cache behavior should one expect of this on a modern laptop CPU? - I haven't seen this approach before, have you?
comment 4y ago · link · parent
The libtcc API is minimal. For my needs that has been 100% sufficient and a pleasure to work with.
comment 4y ago · link · parent
I've been working on a PEG-based Turing-complete language which creates completely standalone and trivially-embedded C. The "selling point" would be "A DSL for creating DSLs".
In the last few weeks I've been working on a libtcc-based add-on in order to build a REPL to help create/explore a desired grammar interactively.