3 ms·
Actually this is pretty cool, you can make the same sort of semantics as C++ stack based objects in plain C. With a couple macros you could make it pretty much
by buserror 11y ago
Actually this is pretty cool, you can make the same sort of semantics as C++ stack based objects in plain C. With a couple macros you could make it pretty much feature equivalent.
Thanks for posting that!
- zvrba 11y ago"Plain C" is defined by the ISO C standard. Once you start using extensions like these you're better off going over to standard C++.
- Gibbon1 11y agoOnce you think you need to move from some flavor of C to standard C++ you should probably switch to a safe proper garbage collected language.
- cremno 11y agosystemd does that: https://github.com/systemd/systemd/blob/v224/src/basic/macro.h#L48 https://github.com/systemd/systemd/blob/v224/src/basic/macro... https://github.com/systemd/systemd/blob/v224/src/basic/macro.h#L477-L482 https://github.com/systemd/systemd/blob/v224/src/basic/macro... https://github.com/systemd/systemd/blob/v224/src/basic/util.h#L491-L520 https://github.com/systemd/systemd/blob/v224/src/basic/util.... https://github.com/systemd/systemd/blob/v224/src/basic/fileio.c#L43-L44 https://github.com/systemd/systemd/blob/v224/src/basic/filei...