#include C headers in D code

Joakim dlang at joakim.fea.st
Tue Apr 10 11:17:11 UTC 2018


On Tuesday, 10 April 2018 at 09:36:39 UTC, Atila Neves wrote:
> On Monday, 9 April 2018 at 20:19:35 UTC, Seb wrote:
>> On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote:
>>> On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote:
>>>> [...]
>>>
>>> This whole idea came about because a couple of years ago I 
>>> was in a team that was responsible for legacy code written in 
>>> C which had no tests. To write tests, we needed both to write 
>>> the tests themselves and some fakes/mocks/doubles for the 
>>> code that we depended on - essentially a whole operating 
>>> system. I wasn't going to write that in C, since life is too 
>>> short for that.
>>>
>>> [...]
>>
>> Speaking of dstep - it has greatly improved over the last 
>> years.
>> I'm interested what stop you from using it or improving it 
>> (instead of rolling your own tool)?
>
> I tried using dstep as the translation engine to avoid 
> reinventing the wheel. I'm lazy, I don't want to write code 
> that doesn't neeed to be written!

Nice work. I prefer the DStep approach of translating the headers 
to D, but obviously it's not going to be as easy for the user as 
this, so this approach has its uses too.

Regarding "reinventing the wheel," I liked this recent blog post 
giving reasons why it can be a viable approach:

https://blog.cerebralab.com/#!/blog/11


More information about the Digitalmars-d-announce mailing list