orangeduck / mpc

A Parser Combinator library for C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why ANSI C?

nmeum opened this issue · comments

Been using your parser combinators for a few projects, so thanks for writing this library! One thing that surprises me though is the choice of C standard. The project seems to be strictly written in ANSI C. This has one major downside: it doesn't allow using stdarg(3) which is only available with > C89. Using stdarg(3) should allow writing variadic combinators (e.g. mpc_or or mpc_and) without explicitly passing the amount of arguments. I often find myself with an incorrect function argument count when using the current version of these combinators.

Does it? I didn't think there was a way to get the number of arguments in a variable arguments call - which is why most libraries either say that the arguments should be NULL terminated, have something like a format string which tells you the number of arguments, or like mpc ask you to give the count too. Perhaps I am missing something I didn't know...

Ohhhhh, you are right indeed. Haven't thought this through properly, sorry for the noise then.