Patrik Stridvall ps@leissner.se writes:
What kludge? Ugly OK, that is your subjective opinion, but kludge? Even if we only see it from a purely C language perspective, it solves the problem of making sure that the C library functions have the prototypes we expect them to have. There is no other way to solve that problem that I can think of so it is certainly not a kludge.
Not only is it not a problem we need to solve, but it's more likely to actually cause new problems. I wouldn't be surprised at all if your patch broke compile on some platforms that have some slight differences in prototypes (like char* vs. const char*).
Well, believe it or not the thought actually occured to me before I submitted the patch, so I actually tested it on Solaris, FreeBSD and Linux, and the only thing I had to change was the include order or stdarg.h to make it work on all platforms.
The thing is that if it actually breaks on some platform it is a red light that something might be (and probably is) wrong. We can always fix it with #ifdef:s and winapi_{check,extract,fixup} or whatever can use the #ifdef to generate a correct entry for that platform if need be.
Of course the more likely scenario will be that it serves as a reminder that we really can't export the C library function directly because of platform incompabillities and simply don't do it.
And no, I don't believe const/non-const is a problem. Beside even if it turn out I'm wrong we can just add a "#define const /* nothing */" at the top of each externs.c file. That, I admit, is a kludge but only a very small and harmless one.
If you are not convinced now, you never will be.
I think we agree on this one ;-)
Probably. I don't have much hope of convincing you with the statement above either.