4 ms·
And then you have to waste couple of hours to do the macro which might or might not be used in the future.
by asutekku 5y ago
And then you have to waste couple of hours to do the macro which might or might not be used in the future.
- wizzwizz4 5y agoEven when I have to look up all the weird syntax for a macro_rules! macro, they take like 10 minutes, tops. If you're taking much longer than that, you're probably trying something too ambitious: it should either be proper code generation (in Rust, a build script or proc macro) or a const fn, or a trait and proper generics. C's even easier; you just write the C code with parens around everything, then run it through cpp, then correct any divergences from the expected code. (It does take a bit longer, though, because the compiler waits until the last minute to shout at you if you make a syntax error.) I can see complicated C++ templates taking hours, but they're not really macros. (They're probably the correct tool for this, though.)