summaryrefslogtreecommitdiffstats
path: root/src/glx/Makefile.am
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-08-23 13:19:19 -0700
committerPaul Berry <[email protected]>2013-08-26 10:15:51 -0700
commitcfe39ea14edc8db13c549b853b214e676f8276f1 (patch)
treedb0e10cf39012dc46f5545e8654f935140c9472c /src/glx/Makefile.am
parent612226c43b072eb45dc3ed21484054824e1c863c (diff)
i965: Allow C++ type safety in the use of enum brw_urb_write_flags.
(From a suggestion by Francisco Jerez) If an enum represents a bitfield of flags, e.g.: enum E { A = 1, B = 2, C = 4, D = 8, }; then C++ normally prohibits statements like this: enum E x = A | B; because A and B are implicitly converted to ints before OR-ing them, and an int can't be stored in an enum without a type cast. C, on the other hand, allows an int to be implicitly converted to an enum without casting. In the past we've dealt with this situation by storing flag bitfields as ints. This avoids ugly casting at the expense of some type safety that C++ would normally have offered (e.g. we get no warning if we accidentally use the wrong enum type). However, we can get the best of both worlds if we override the | operator. The ugly casting is confined to the operator overload, and we still get the benefit of C++ making sure we don't use the wrong enum type. v2: Remove unnecessary comment and unnecessary use of "enum" keyword. Use static_cast. Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/glx/Makefile.am')
0 files changed, 0 insertions, 0 deletions