On 03/21/2013 05:00 AM, Jacob Carlborg wrote:
On 2013-03-21 07:59, 1100110 wrote:
"""
In particular,
Replace C's include
Each #include needs to have a corresponding import path.to.header;
"""
That has certainly not been my experience. Often one D import will map
to a couple of c includes.
I would suggest amending that statement. It sounds too much like a hard
rule(necessary to be considered for inclusion into Deimos) to me. YMMV.
I would say that each #include should have _at least_ one corresponding
import. Then there could be additional imports as well.
Sure, there could be unnecessary includes but that's not very likely.
Oh, we aren't on the same page.
Here, I'm curious as to how you would translate these into D.
#include <stdbool.h>
#include <stdarg.h> /* we need va_list */
#include <stddef.h> /* we want wchar_t */
> Sure, there could be unnecessary includes but that's not very likely.
Two out of Three of those are a builtin type(bool and wchar), and the
other one is... Well... I'm not sure, but no one's missed it
yet.(pretty sure it was a hack to get around something in C.)
(Any good reads on D's Variadic Functions by chance?)
So it actually seems to be pretty likely in practice.
About as likely as any given C project to roll their own boolean type.
Which apparently is *really high*. =P
"""
Forgot to say, I usually just remove all includes and then add imports
using trails-and-error.
"""
Grep and locate are your friends. As well as "replace all". ;)
But yeah, that's the way to do it.