Re: [boost] Checked Integral Class

matt, i don't think your code example disambiguates what rob and i are disagreeing on when you say:
MyCv c = a + b; // Should fail
you don't say why you think it should fail. there are (at least) 3 possibilities: a) at compile time (because it is an error to try to assign a 0-20 number to a 0-10 number) b) at runtime, during the assignment (because it is an error to assign a 0-20 number to a 0-10 number if it is outside the 0-10 range) c) at runtime, during the addition (because it is an error to add two 0-10 numbers if they add up to more than 10)
i think a) and b) are both useful, and i think rob is advocating c) Your correct, I had thought I understood what Rob is talking about. I think what's causing confusion is that there are really two issues - compile time behavior and runtime behavior. I'm getting the two conditions mixed together because I need both. I need to defend against all three possibilities, I need to catch the programmers mistakes at compile time but I also need to catch the application errors at run time.
Scanned by Fortigate {X3BTB534}
participants (1)
-
Matt Doyle