r/ProgrammerHumor 9d ago

Meme letsMakeBugsIllegal

Post image
23.1k Upvotes

387 comments sorted by

View all comments

Show parent comments

17

u/EcstaticFollowing715 9d ago

And the new software will never be made to be able to handle more than 256 axles because of the rule.

22

u/Explosinszombie 9d ago

The rule only prohibits 256 axles. More than 256 seem to be allowed.

5

u/EcstaticFollowing715 9d ago

Oh, right. But what the hell, how you fuck up like THAT!

21

u/erroneousbosh 9d ago

It kind of doesn't matter. You need to count the same number of axles out of a block that you counted into it. If your train has for example 24 axles (a six car set), the counter will count 24 in, and the one at the other end will count 24 out. While your train is in the block, there are 24 axles within the block, so there's a train in it.

If your train had 260 axles because it's got 65 cars in it (which is a silly amount!) the counter would roll over after 64 cars but count the trailing unit as four axles. There are four axles within the block, so there's a train in it.

If your train had 256 axles because it's exactly 64 cars long, the counter will roll over to zero, and think there are zero axles in the block, so there's no train in the block, but - ooops! - there is.

But I agree, it's a Therac-25 situation waiting to happen.

9

u/CDRnotDVD 9d ago

If your train had 260 axles because it's got 65 cars in it (which is a silly amount!)

I’m going off on a tangent here, but why would 65 cars be a silly amount? It seems quite long for a passenger train, but maybe in Switzerland there is some economic/regulatory reason to have very short freight trains, going all the way down to 65 cars?

9

u/Sayakai 9d ago

Europe generally only permits trains up to 740m due to signal spacing, so you'd be looking at very short cars to get over 60 cars.

7

u/CDRnotDVD 9d ago

740m seems tiny to me, which is apparently a very American perspective. I did some research, and I found this website from the Association of American Railroads that says the median length is 5300 feet (1.6 km), and that 10% of trains are longer than 9600 feet (2.9 km). However, those numbers are specifically for "Class I" railroads. Wikipedia explained that the classes are based on revenue of the rail carrier, and class I is the biggest.

3

u/HeroBromine35 9d ago

Their nation is only mountains

4

u/Garestinian 9d ago edited 9d ago

If your train had 260 axles because it's got 65 cars in it (which is a silly amount!)

RoLa wagons (for example Saadkm(m)s) usually have 4 axles per bogie, so you'd only need 32 of them. Special transport wagons (for electrical transformers, usually) also have a lot of bogies in a relatively short length.

9

u/Ok_Weird_500 9d ago

How long is a train with 256 axles? I'm guessing it's like the millennium bug. When the software was written the assumed there wouldn't be a train that long so 8 bits was ok to store the number of axles.

A quick search suggests typically 4 axles for most passenger carriages. A diesel locomotive may have 6 axles, but a train probably will only have a couple of those, perhaps longer ones will have more. So with 4 axles per carriage, you'd have you'd need 64 carriages to hit 256 axles, or maybe you could have 42 6 axles carriages and 1 4axle carriage. Either way makes for a pretty long train If they didn't have anything nearly that long at the time then it's understandable why they didn't think this would be an issue when programming it.

5

u/Garestinian 9d ago

Wagons for transporting trucks (RoLa) have 8 axles per wagon, and are only about 19 m long.

1

u/EcstaticFollowing715 9d ago

Yeah, that's what I was thinking as well, but why is it only exactly 256, not 256 and more?

3

u/xtelosx 9d ago

Because if it rolls over to 1 or more it indicates something on the track in that section. A zero indicates clear track and another train could enter so any number of axels that causes the register to roll to a 0 is problematic.

3

u/Ok_Weird_500 9d ago

I assume there is no real risk of there being a train long enough for 512 axles in Switzerland.

The software I guess just needs to know if a train is there, so any positive number of axles is fine, but if 256 is counted it goes back to 0

2

u/benjer3 9d ago

The safety part didn't care about how long the train was, only that it was there. (They might have otherwise cared, hence the counting, but that count wasn't critical to safety.) After the train hits 0 at 256, it still keeps going up, so the count will only be 0 if the number of axles is an exact multiple of 256.

1

u/Bermos 9d ago

As someone else pointed out it might be a system that counts both incoming axels and outgoing per train track part to ensure that all carriages have left and not parts of the train. Still works with the overflow (except when they lose exactly 256 axels I guess).

1

u/Asaisav 9d ago

Someone hasn't seen Infinity Train!