Remix.run Logo
dwattttt 3 hours ago

An assertion is an app crashing on a violation. The problem is when it's not guaranteed to crash, and instead does something very wrong.

jstimpfle 2 hours ago | parent [-]

A bug is a bug even when it doesn't clearly manifest itself 100% of the time, and furthermore it is pretty much guaranteed that NULL dereference crashes with segfault in practice, only not for the people playing theoretic games whose essence of life is finding gotchas where it maybe isn't so and then feeling smarter than everyone else.

But it's >> 99.9% true that this will just crash even though it's acshually UB, nasal demons and so forth. Now raise this << 0.1% likelihood that it isn't true on some system with some compiler and build flags, to the power of the number of distinct deployed configurations out there, and you get the result which is the correct engineering decision of just moving on instead of spending your life filling straightforward code with pointless boilerplate assertions.

NB it can make sense to assert nonnull when the condition won't be tested on all code paths or the intention is otherwise not super obvious.

lmm 30 minutes ago | parent | next [-]

> it's >> 99.9% true that this will just crash even though it's acshually UB, nasal demons and so forth.

Is it though? Linux saw enough bugs from that kind of issue that they now build with -fno-delete-null-pointer-checks and accept the (supposed) performance penalty.

Dylan16807 2 hours ago | parent | prev [-]

I don't want to nitpick people often but your use of division sign to mean percent is really throwing me off.

jstimpfle 2 hours ago | parent [-]

Thanks for letting me know, nitpick appreciated. Typing on my phone.