That's nothing. Signed overflow in C/C++ is _undefined behavior_. Which means there's no guarantee that you'll get anything recognizable out of it. :-)
But unsigned overflow is defined. Are we expecting a negative number of axles?
Trains in Switzerland are not allowed to have 256 axles
71–80 of 92 posts
Re: Trains in Switzerland are not allowed to have 256 axles
#72Earlier quoted context omitted.
Signed numbers are preferred. Imaging you try to buy something checking if the remaining balance would be greater than zero is pretty much guaranteed, resulting in 4+ billion instead. Signed number (just 64bit) is the correct number type for such operations.
Pushing it off to the negatives does not solve the issue of overflow.
Re: Trains in Switzerland are not allowed to have 256 axles
#73Earlier quoted context omitted.
Signed numbers are preferred. Imaging you try to buy something checking if the remaining balance would be greater than zero is pretty much guaranteed, resulting in 4+ billion instead. Signed number (just 64bit) is the correct number type for such operations.
Pushing it off to the negatives does not solve the issue of overflow.
it allows for comparison with errors. Working with unsigned numbers is error prone... and I started with 6502 that didn't have signed numbers.
The idea is preventing the overflow by being able to check for negatives easily. Having negative gold is likely better than leaving someone with 4billons of. For instance stuff like "max(0, balance)" just doesn't work with unsigned ones.
Re: Trains in Switzerland are not allowed to have 256 axles
#74Re: Trains in Switzerland are not allowed to have 256 axles
#75Earlier quoted context omitted.
Or just more light , and focus on shooting the dark spots.
Or just _more_ light, and you don’t need to shoot because everything vantablack will be aflame...
Re: Trains in Switzerland are not allowed to have 256 axles
#76Earlier quoted context omitted.
I would wager that they might be as meticulous in Japan too.
I’m glad I read an article on HN about pointing and calling[0] in the Japanese rail system as a way of preventing accidents. I take a blood pressure medication and had once or twice taken it a second time in the day, which wiped me out and made it VERY difficult to work (for the record, I don’t take it for blood pressure and it’s a very low dose, so I wasn’t at risk of my heart stopping, just very sleepy). Now I do a…
I should start doing it with shampoo when I shower.
Re: Trains in Switzerland are not allowed to have 256 axles
#77I'm waiting for the freak accident when a 200-axle train enters a given segment, and then later a 56-axle train accidentally ignores a red light, and plop the segment is now marked as all-clear again.
Re: Trains in Switzerland are not allowed to have 256 axles
#78Earlier quoted context omitted.
What if Swiss trains consist of 30-40 cars at most? Then the rule is purely technical and doesn't even have to be remembered.
Actually, the longest regular Swiss trains seem to top out at 44 cars. This is because of passing siding lengths being much smaller than other countries such as the US. There are longer trains that are scheduled on routes with longer sidings however such as a the main north/south routes. Most European trains rarely exceed 22 cars for the same reasons as they have to be able to be passed by express trains in stations.
Re: Trains in Switzerland are not allowed to have 256 axles
#79Earlier quoted context omitted.
Some people just really, really dislike unsigned ints.
I've run into programmers that think something terrible is going to happen if you use an unsigned int for anything.
Re: Trains in Switzerland are not allowed to have 256 axles
#80Earlier quoted context omitted.
I've run into programmers that think something terrible is going to happen if you use an unsigned int for anything.
Is there a popular language these days that throws an exception whenever an unsigned int overflows?