Pierre Habouzit wrote:
Well htod does that, but it's very impractical to write them from
scratch.
True. I haven't tried yet (nobody else seems to care about it as much as
you do!), but I think this could be automated fairly easily with a template.
And for that bit-fields are
a really really fast and simple way to describe things.
I should point out that inline functions are inlined, and there is no
speed difference in the result.
Not to mention that the usual C idiom:
union {
unsigned flags;
struct {
// many bitfields
};
};
Would need an explicit copy_flags(const my_struct foo) function to
work. Not pretty, not straightforward.
I'm not following this. To copy a union, you just copy it with the
assignment operator:
U a, b;
a = b; // copies all the bit fields, too!
D does come with htod, which converts C .h files to D files.
Last time I checked it was only available on windows, and closed
source, both are an impediment for many people.
You're right on both counts. It's because htod is built out of a fork of
the Digital Mars C compiler. Something similar could be done with gcc,
but I'm not the person to do it. I should also get off my lazy tail and
port htod to linux.
Right now, for D, only
gdc exists, it lags behind dmd quite a lot afaict, and there is no other
toolchain helpers yet.
GDC was just released for D 1.020, which is behind D 1.021, but 1.021
was released just a couple days ago <g>.
For the record I wasn't suggesting to rewrite git in D at all. I just
happened to see your post, and being very interested in where D is going
because I feel it's an excellent langage, and saw an opportunity to
mention a few quirks I feel it has, so, well, I answered :)
And it's nice to hear your perspective, which is why I dropped by this
thread.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html