#golang trick: test whether two structs have the same size at compile time: https://play.golang.org/p/cnaAt-hsTTG
-
-
(In other words, both of the previous tricks I posted can be expressed in terms of this one -- it's a generalized form that can check any boolean expression.)
Show this thread -
Compile-time assertion that a constant is a power of 2: var _ [0]struct{} = [c & (c - 1)]struct{}{}
Show this thread
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.