Make parsers `foo__m` macros that expand to `foo__m(mm__, ...)`
This is an idea for a possible enhancement. Feedback welcome!
For the default case, a user would globally declare mm__ = &h_system_allocator
. In combinators, the standard argument would shadow the global variable.
Benefits:
- (Motivation:) In an allocator-specific function, shadowing the global ensures that the user cannot use it. This is important in the
h_bind
combinator I made for DNP3: It typically allocates continuation parsers on every call during the parse and one missed allocation makes a memory leak. - Allocator-specific code remains as readable as code using the default allocator.
Cons:
- User has to add one boilerplate delaration in the typical case.
- Does this generate trouble for bindings?
- Danger of mistyping the standard argument and defaulting to the global.