Subj : Re: bit field bug? To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Mon Nov 17 2003 06:42 pm Andrue Cope writes: > Bitfields should be avoided as if they were the spawn of the Devil > ]:-) I think that you are overstating your point. > The C++ standard has never bothered to specify how the bits are to > stored. It is implementation specific. As with any C or C++ feature, one should take care not to assume guarantees that don't exist. But within these guarantees, I don't see why bitfields shouldn't be used. > I can tell you now that > different Borland compilers store them differently so trying to > compile code from another vendor's compiler is really asking for > trouble. If the bitfield definition is correctly guarded with the necessary preprocessor "scaffolding", you'll get a nice little compiler message (to be honest: you'll get one per #inclusion of that header). I have yet to see a non-trivial project that does not, to some extent, depend on implementation specific features. Do you see a fundamental difference between bitfields? > I would: > > 1. Get rid of the bitfields. > 2. Give the developer who used them a bit of a kicking or at least a > talking to. If I understand the OP correctly, the program to be ported did not contain the scaffolding; some talking might be in order. .