Hacker News new | past | comments | ask | show | jobs | submit | snappythrowaway's comments login

What is UB?


It's what happens when you make a union of an int and a float and write it as an int and read it as a float.

Most compilers will do something like "treat the bits like they represent a float, even though they mean something else when they're treated as an int."

But the language spec says the compiler is allowed to send an email to Bjarne Stroustrup with your home address so he can come over and personally set your computer on fire.


I bet on Bjarne Stroustrup being too busy setting other programmers computers on fire before coming to mine.

More seriously, the typical response to undefined behavior is for the compiler to optimize out whatever code may trigger it. It is great for performance and one of the reasons C and C++ often top the charts, but it may lead to weird bugs that depend on the optimization level.

For the union case, the compiler could completely remove the code that reads the float: because it is UB, it is something you shouldn't do, so it considers that you will never do it, so it can just remove the code. In the end your conversion function may do nothing at all (very optimized!). In practice, because it is so common, even though it is UB, it will usually do what you want it to do.


Undefined behaviour.

Here's an article on the topic: https://cryptoservices.github.io/fde/2018/11/30/undefined-be...


There are acceptance tests, intergration test and actually many other types. I'm similarly not familiar with kernel dev. Have studies both operating systems and distributed systems aswell as CS. But the build checked all the right boxes.


i always open everything in new tab. Is it safer this way?


It's safer against this back button hijack indeed


  - Switch over from centralized storage to decentralized storage [completed],
kind of looks like they are already there?


I would suggest a emoji based labeling system. Not too intrusive (grey scale) that somehow could signal if article is paywalled / blocking visitors with ad-blockers.

For a subset of users (either detected or by user preference), there might be another useful symbol as well for indicating if a website is not tor friendly.


PLOS uses this logo for open access: https://commons.wikimedia.org/wiki/File:Open_Access_logo_PLo.... (an open lock) Based on that Wikipedia uses a closed lock to indicate paywalled sources: https://commons.wikimedia.org/wiki/File:Closed_Access_logo_a.... So how about these: [Closed lock] [Open lock]? (TIL HN doesn't support emoji) I think reddit also allows image use via CSS.


I would prefer not reusing closed lock since it represents encryption in most browsers.


Hmm that's a fair point even if it's in a different context since ideally each symbol would retain its own meaning. I'm not sure what a better icon would be then that would be intuitive unless one was decided upon and widely used.


Its a recent user training issue, so, if it wasn't so soon I would be all happy, but finding a better icon would probably be better.

A book with a lock might work.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: