On Sunday, November 11, 2012 23:06:45 David Nadlinger wrote: > On Sunday, 11 November 2012 at 21:15:42 UTC, Jonathan M Davis > > wrote: > > They're obviously not regulated, so just go for > > typeof(vote).max. ;) > > I'm afraid this would backfire – assuming that votes are > integral, if somebody else also supported the issue after me, > then the votes would either be reset or we would have undefined > behavior. ;)
No. This is D. It wouldn't be undefined at all. It would just wrap around to typeof(vote).min. That should be completely defined for integral types (for that matter, it's well-defined in C land too. It's just that you have issues with the size of the type changing depending on which machine you compile on). I'm not sure what happens with non-integral types though. I _was_ pretty much assuming an integral type. But yes, that would be a problem, because you would have nullified all future votes. typeof(vote.max) / 2 it is then. ;) - Jonathan M Davis
