proper bit fields in the D2 language?

nobody hehe at hehe.com
Tue Apr 21 22:17:42 PDT 2009


I remember read D's introduction page that C's bit field is something will be
dropped from D.

But now I see dmd/src/phobos/std/bitmanip.d line 30 ~ 98: bit field functions
are generated at compile time,

private template createAccessors(...) {
  // getter
  // setter
  ...
}

I wonder how efficient is this. If we are going to have bit fields in the
*std* library, why not support it properly in the language. I think the
compiler can generate much better code than these compile-time generated
functions, which looks like a hack to me.

comments?



More information about the Digitalmars-d mailing list