Merging changes to volatile bitfield structs

Fabian Cenedese Cenedese@indel.ch
Tue Oct 16 11:31:00 GMT 2007


>So maybe I need to not declare it as volatile, and use some sort of "memory barrier".  That's a term that I have heard used but don't really understand.  But borrowing database terminology, how about
>
>  BEGIN
>    reg.a = 0;
>    reg.b = 0;
>    reg.c = 0;
>  COMMIT
>
>Can anyone share their preferred approach to this sort of problem?

You can wrap it into a class that provides the necessary functions
like SetBit, ClearBit, ToggleBit, Begin, Commit, Reset etc.

If you have C instead of C++ you can do the same with global
functions and the bitfield as additional argument.

bye  Fabi




More information about the Gcc-help mailing list