HNHacker News
TopNewBestAskShowJobs

rand_flip_bit

68 karma · joined October 8, 2022

submissionscomments
rand_flip_bit··on My review of the C standard library in practice
Sadly, this actually isn’t true, and can cause some dangling/use-after-free issues. An empty string_view has a length of zero, but it’s representation might contain a null/non-null pointer + zero or two pointers that “compare equal”. I put compare equal in quotes because pedantically, after delete/free are called, they will not be required to compare equal.
rand_flip_bit··on Unix time is bad and needs replacement, not UTC
For the purposes of a stopwatch/timer, this is exactly what you want. A measurement of time that is exact and does not include leap seconds. Accounting for DST or leap seconds or any other changes to the local timezone for that matter would be disastrous. Imagine you are trying to bake a cake and the timer doesn’t go off for an extra hour due to the clocks getting set back. Now you just have a ruined cake :(

As far as Unix and UTC are concerned, many systems provide the option to smear the system clock over a 24h period (-12h, +12h) centered on the leap second. This avoids the discontinuity and can help avoid errors some incorrectly written programs may not be able to tolerate.

For leap smearing, see: https://developers.google.com/time/smear

rand_flip_bit··on On “correct and efficient work-stealing for weak memory models”
Sadly, while Chase-Lev is great, there is currently a patent for the algorithm that won’t expire until 2025. Of course, this algorithm is held by non other than Sun/Oracle.

Once I discovered this, I had to switch over my implementation to something less… of a legal risk. What a shame.

← PreviousPage 2 of 2