On Wed, May 31, 2017 at 10:42 PM, Jason Ekstrand <ja...@jlekstrand.net> wrote: > On May 31, 2017 9:32:23 PM Ian Romanick <i...@freedesktop.org> wrote: > >> Having the unsupported format value not be zero isn't very safe. The >> C99 rules say that any field missing an initializer is implicitly >> initialized to zero. If a MESA_FORMAT_ value is added but is not added >> to the array initializer, we'll have this same problem... but in a way >> that is much harder to detect. > > > Good point. Chad, how would you feel about leaving things zero and then > having a loop that walks the array, knows about the one special case, and > sets all unsupported things to ISL_FORMAT_UNSUPPORTED? Then we get the best > of both worlds.
You can actually just use the GNU C range initializer and leave the array static const: int array[100] = { [0 ... 99] = -1, [1] = 1, [2] = 2, }; _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev