how should c bitflag enumerations translated c++?


c++ mostly superset c, nonetheless always. particular, while bulletin values both c c++ many modify int, shelter isn't true: wholly c ints modify behind bulletin values. thus, bitflags tangible around bulletin declarations don't work correctly. hence, ok c, nonetheless c++:



typedef enum foo
{
foo_first = 1<<0,
foo_second = 1<<1,
} foo;

int main(void)
{
foo x = foo_first | foo_second; // blunder c++
relapse 0;
}


how should problem burnished good correctly, ideally but harming debugger-friendly inlet controlling foo non-static form (it decomposes member bitflags watches etc.)?



consider also there competence hundreds such fall enumerations, thousands use-points. ideally kind fit user overloading trick, nonetheless unequivocally ought efficient; concentration i have mind compute-bound repute being fast.



clarification: i'm translating infinite (>300k) c way c++, i'm looking an fit interpretation both run-time developer-time. simply inserting casts suitable locations take weeks.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

using mvc, should hoop communication between views? between models?