http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48419
--- Comment #1 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-04-02 21:12:25 UTC --- (In reply to comment #0) > For #2 there are a few options. Say, > > a) A char array containing all the data. Walk over the flags variable, and for > each set bit, read the appropriate number of bytes from the char array and > bump > a pointer to the current position. This is probably the most space efficient, > but might run into alignment issues on some targets? So maybe one needs to > memcpy() the data to some properly aligned data before actually using it. > > b) Create a union of all the specifier data structs. Then pass an array of > this > union type, with the flags variable specifying the type of each element (that > is, the length of the array is the number of set bits in the flag variable). > This might waste a bit of space compared to the previous approach, but should > ensure that everything is properly aligned. From a brief scan of current > sources, the biggest element is probably for character variables, which is a > pointer to the string and the length, so in no case will the union type be > particularly large. > > c) Get rid of the flags variable, and instead pass a variable specifying the > array length, the array elements being a struct of an enum specifying the > element type, and the union type described in the previous approach. > > Personally, I think option c) looks the cleanest. I meant that I'd prefer b), not c). In any case, whichever is preferred also depends on what is easy-ish to do in the frontend.