Is importC ready?

bachmeier no at spam.net
Thu Nov 11 16:58:24 UTC 2021


On Thursday, 11 November 2021 at 02:32:21 UTC, Walter Bright 
wrote:
> On 11/9/2021 8:41 AM, bachmeier wrote:
>> I tried to compile a simple C file this morning, containing
>
> The things that tripped are C extensions, not C11. Especially 
> the errors about `__extension__` :-/
>
> Anyhow, `restrict` works. You can do things like:
>
>   #define __restrict restrict
>
> or even:
>
>   #define __restrict
>
> before the #include. (ImportC just ignores the `restrict` 
> keyword, which is Standard compliant behavior.)
>
> Over time, we'll probably add support for extensions. But for 
> the moment, it's for C11 code.

I have no problem with the lack of support for extensions. The 
problems are:

- The error messages tell you nothing. The only solution is to go 
through the entire (large) preprocessed C file and identify every 
problem, with no help from the compiler. The error message that 
caused me to file the bug was `illegal combination of type 
specifiers`. After more than an hour of working on it, I had 
finally commented out enough lines to make the error messages go 
away.
- It's not obvious to someone lacking a strong understanding of C 
compilers how to make the correct adjustments to the code. For 
instance, what am I supposed to do with `_Float128` to get 
something that runs *and* is guaranteed to no change the behavior 
of the code? I've never written a line of C code that used a 
compiler extension in my life. It would require a major 
investment on my part.


More information about the Digitalmars-d mailing list