logoalt Hacker News

SkiFire13last Saturday at 7:05 PM2 repliesview on HN

This is not just expressing intent. The documentation clearly states that it's UB to violate them, so you need to be extra careful when using them.


Replies

riazrizvilast Saturday at 7:13 PM

Perhaps another helpful paradigm are traffic/construction cones with ‘do not cross’ messages. Sometimes nothing happens, other times you run into wet concrete, other times you get a ticket. They’re just plastic objects, easy to move, but you are not meant to cross them in your vehicle. While concrete bollards are a thing, they are only preferable in some situations.

show 1 reply
Phil_Latiolast Saturday at 7:34 PM

> documentation clearly states that it's UB to violate them

Only in "fast" mode. The developer has the choice:

> Compilation has two modes: “safe” and “fast”. Safe mode will insert checks for out-of-bounds access, null-pointer deref, shifting by negative numbers, division by zero, violation of contracts and asserts.

show 1 reply