Is importC ready?

bachmeier no at spam.net
Thu Nov 11 17:06:15 UTC 2021


On Thursday, 11 November 2021 at 16:58:24 UTC, bachmeier wrote:
> 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.

And to elaborate further on the second point, I went through all 
of the items [listed on this 
page](https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html) last 
night to assess the size of the problem. I couldn't even 
understand what some of them were saying. It would really help if 
the compiler would automatically add lines like `#define 
__restrict restrict`.


More information about the Digitalmars-d mailing list