We're about 3 bugfixes and a major feature away from a 1.0 release. :-)
Feel free to ask questions here. ("OMG, why not use clang?!", "How complete is the support for C++?")
Are you still mentally healthy after trying to handle the Most Vexing Parse?
Yeah, I'm fine. c2nim always needs more polish but its basic parsing strategy aged really well -- custom preprocessor + parser with backtracking.
I know it is my lack of knowledge here, but c2nim tend to show errors like:
Error: token expected: ; but got: [identifier]
It would be nice if the error messages were a bit more informative.
I think it would be nice if it always produced an output (trying to produce warnings rather than errors).
It is great seeing that c2nim is getting love.
designated initializers
Thank you! It’s the most common issue I find importing C apis.
I have been using c2nim the first time. The single line file
#define LOOP(var,num) for (var = 1; var <= num; ++var)
bails out with
Error: did not expect [NewLine]
Is there a list of c2nim's limitations (for C macros)?
c2nim doesn't parse C preprocessor macros / directives.
Best thing to do is run a C preprocessor over the file first and then invoke c2nim. You can accomplish this with gcc by doing something like:
gcc -E header.h -o header_preprocessed.h
Also I agree with the general sentiment that c2nim is great and I am a regular user of the tool.
c2nim doesn't parse C preprocessor macros / directives.
No... It does parse them.
Best thing to do is run a C preprocessor over the file first and then invoke c2nim. You can accomplish this with gcc by doing something like:
That's a bad advice, better learn how c2nim actually works...
Is there a list of c2nim's limitations (for C macros)?
There is documentation:
https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#preprocessor-support
Random question: where would I start to add an option to c2nim that would convert C’s stdint types to Nim equivalents? Even a pointer to roughly the right area/module.
As in converting all “int8_t” to “int8” (Or point out if I’m missing an existing ability!).
I will add C++20 support, eventually.