Hi,
I'm not sure if this is the right list, if not please redirect me.
So, I tried compiling luametatex using g++, and noticed some things that prevent it from also being considered valid C++ code.
Two general problems are:
1) Initialization order. C++ wants initializers to be specified in the order in which they will actually initialize the object, i.e. in the order of the members.
2) Reserved names. Some variables are named `class` or `template`, which of course, breaks C++.
But more interesting are the specific pieces of code that get rejected, because C++ is a bit more strict than C in some cases.
3) We get one complaint about comparing a pointer to an integer using <, which I believe is an actual bug in the code.
4) A second complaint is about dropping const in `tex_to_cstring`. I don't think this causes an actual error in the program, though.
5) Some of the `goto`s cause problems, because the jump skips over the initialization of variables in the target scope. Again, these variables are not used, so I don't think there is an actual error. The easy fix here is to just move the code from the `goto` target into its own function, which is probably better for readability anyway.
6) The last problem is that things break with g++ if the marco `infinity` is defined.
I've attached patches for 3), 4), and 5), as I think that these benefit code quality in general. I can also send ones for 1) and 2), if there is interest. 6) seems to be a more general incompatibility, I'm not sure if there is a "fix" that doesn't require #if s.
Kind regards,
Erik