Add ImportC compiler to dmd

Max Haughton maxhaton at gmail.com
Mon May 10 01:13:25 UTC 2021


On Monday, 10 May 2021 at 00:47:22 UTC, Walter Bright wrote:
> On 5/9/2021 4:27 PM, Max Haughton wrote:
>> `inline` in the C standard (although given as an example C11 
>> footnote 138) technically *only* has guaranteed implications 
>> other than actually inlining the function, is ignoring it 
>> valid?
>
> C11 6.7.4-6 says:
>
> "A function declared with an inline function specifier is an 
> inline function. Making a function an inline function suggests 
> that calls to the function be as fast as possible. The extent 
> to which such suggestions are effective is 
> implementation-defined."
>
> Ignoring it is not only valid, it's what modern C compilers do 
> anyway.

Which is why I bring up that `inline` *is* used in modern 
programs, but not for performance, specifically in header files 
for example.

```
#include <stdio.h>
inline int square(int num) {
     return num * num;
}

int main()
{
     printf("%d\n", square(3));
}
```
fails to link in C but not in C++.

I don't know whether this actually breaks anything since D 
doesn't really have a "you have permission to emit nothing" 
keyword.


More information about the Digitalmars-d mailing list