On Fri, Sep 07, 2007 at 07:51:11PM +0000, David Kastrup wrote: > Pierre Habouzit writes: > > [bit fields] > > > Really, I feel this is a big lack, for a language that aims at > > simplicity, conciseness _and_ correctness. > > > > OK, maybe I'm biased, I work with networks protocols all day long, so > > I often need bitfields, but still, a lot of people deal with network > > protocols, it's not a niche. > > And strictly speaking, C bitfields are completely useless for that > purpose since the compiler is free to use whatever method he wants for > allocating bit fields. So if you want to write a portable program, > you are back to making the masks yourself. The point is (1) D is not C, (2) we all know that linux e.g. does that in many places using the fact that it knows how the supported compilers (gcc icc tcc maybe some other) do their packing. The discussion is about D. D solves the infamous problem with longs not having the same size everywhere, I don't see why it couldn't solve the bitfield issue either. > Where bit fields work reliably is when you are not interchanging data > with other applications, but just laying out your internals. Thank you for the _C_ lesson. -- ·O· Pierre Habouzit ··O madcoder@debian.org OOO http://www.madism.org