My advice on implementing stuff in C:
My advice on implementing stuff in C:
Posted Oct 18, 2010 22:01 UTC (Mon) by cmccabe (guest, #60281)In reply to: My advice on implementing stuff in C: by HelloWorld
Parent article: Russell: On C Library Implementation
> preprocessor due to this, for example you can't check whether two
> arguments of a macro are of the same type
From kernel.h:
> /*
> * min()/max()/clamp() macros that also do
> * strict type-checking.. See the
> * "unnecessary" pointer comparison.
> */
> #define min(x, y) ({ \
> typeof(x) _min1 = (x); \
> typeof(y) _min2 = (y); \
> (void) (&_min1 == &_min2); \
> _min1 < _min2 ? _min1 : _min2; })
I'm getting a little tired of being told what I can't do, especially when it turns out that I can do it after all.
From the Project Lombok web page:
> Data is nice, but its certainly not the only boilerplate buster that
> lombok has to offer. If you need more fine grained control, there's
> @Getter and @Setter, and to help you in correctly cleaning up your
> resources, @Cleanup can automatically and without cluttering your source
> files generate try/finally blocks to safely call close() on your resource
> objects. That's not all, but for the complete list you'll need to head
> over to the feature overview
So in other words, it's just yet another code generator.
> Writing a Lisp macro that generates parsers isn't harder than writing a
> Lisp program that does.
And writing a domain-specific language in Ruby is easier still. Apparently high-level languages do high level things better than low-level languages do. Film at 11.
