Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
haberman
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
26 ms
·
301.
▲
by
haberman
4y ago
> Infinite loop with a constant expression is defined behavior. Yes, because a constant controlling expression is one of the enumerated exceptions to the rule against infinite loops. > You're showing potentially infinite loops
302.
▲
by
haberman
4y ago
> It only allows the compiler to assume loops with non-constant expressions can terminate. (And a bunch of other exceptions where it cannot.) That is basically what I said: loops can be assumed to terminate, except for an enumerated set
303.
▲
by
haberman
4y ago
I think this hits the nail on the head. Many people in this thread are confused and think that unreachable UB (either statically or dynamically unreachable) compromises the entire program. This is not true, but your comment helps me better
304.
▲
by
haberman
4y ago
> An infinite loop is not UB. It is well defined. From C11: > An iteration statement whose controlling expression is not a constant expression,156) that performs no input/output operations, does not access volatile objects, and p
305.
▲
by
haberman
4y ago
DR 109 allows that a program may be strictly conforming even if some possible executions of the program invoke UB: > A conforming implementation must not fail to translate a strictly conforming program simply because some possible execut
306.
▲
by
haberman
4y ago
I don't think this is correct. If UB is never invoked, the program is conforming and must be translated/executed correctly. DR #109 specifically states that a compiler may not fail to translate a strictly conforming program just
307.
▲
by
haberman
4y ago
The compiler is required to successfully translate a program that contains unreachable UB, and such a program is conforming if undefined behavior is never reached. This is explicitly spelled out in https://www.open-std.org/
308.
▲
by
haberman
4y ago
> Someone seeing that function may be tempted to say that it's not UB to call with a NULL value as long as the dereference doesn't happen (say, bar() could call exit() or it could run an infinite loop). An infinite loop is UB f
309.
▲
by
haberman
4y ago
I don't think this proves the point, because foo() will not invoke UB unless it is called with a NULL argument. It is true that when foo() is called with a NULL argument, the UB will be realized before bar() has had a chance to run (ED
310.
▲
by
haberman
4y ago
I checked the footnote. It describes a case where invoking UB (transmuting "3" to a bool) can cause dead code to become live. But transmuting "3" to a bool is itself UB. So this fails to prove that execution becomes u
311.
▲
by
haberman
4y ago
Definitely that is true, I wrote a comment about that here: https://news.ycombinator.com/item?id=18041047 Another issue with Python is that the language semantics are much more subtle. This is an excellent talk that shows h
312.
▲
by
haberman
4y ago
Yes, I've already experimented with doing this, see: https://github.com/haberman/llvm-project/commit/e8d9c75bb35c... But when I tried it on my actual code, the results weren't quite as good as I hop
313.
▲
by
haberman
4y ago
I tried exposing the "cc 10" and "cc 11" calling conventions to Clang, but was unsuccessful. With "cc 10" I got crashes at runtime I could not explain. With "cc 11" I got a compile-time error: >
314.
▲
by
haberman
4y ago
Great summary, this matches my experience. For straight-line code, modern C compilers can't be beat. But when it comes to register allocation, they constantly make decisions that are real head-scratchers. One of the biggest problems
315.
▲
by
haberman
4y ago
> With the tail-call approach, each bytecode now gets its own function, and the pathological case for the C/C++ compiler is gone. And as shown by the experience of the Google protobuf developers, the tail-call approach can indeed be
316.
▲
by
haberman
4y ago
A key part of religious extremism is trying to impose one's own morality on others. Where are the effective altruists trying to control the actions of others in the name of EA?
317.
▲
by
haberman
4y ago
When I saw this page a few years back I had an idea for a project. I want to create the lowest-latency typing terminal I possibly can, using an FPGA and an LED array. My initial results suggest that I can drive a 64x32 pixel LED array at
318.
▲
by
haberman
4y ago
I am curious to hear some specifics of why APE did not work with nasm or fasm. Your earlier comment mentioned "tight cooperation with the linker" -- I don't know what this means. My mental model is that all assemblers ultim
319.
▲
by
haberman
4y ago
> most of the savings come from not wasting power while braking That doesn't check out for me. ICE engines are inefficient because much of the energy from the fuel is converted into heat rather than kinetic energy. Every ICE engin
320.
▲
by
haberman
4y ago
I'm curious how small a conforming WASM implementation can be (Luna looks extremely small, but not conforming). In particular I'm curious how feasible it is to create WASM polyfills for various languages. Imagine you have a nice
321.
▲
by
haberman
4y ago
Agreed that it would be better if C had standardized versions of GCC's overflow checking functions: https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Integer-Overflo... With these functions, it could be writt
322.
▲
by
haberman
4y ago
Even more satisfying, I tried this out in godbolt and it appears that compilers are able to optimize that check into a single `mul, jo` (jump on overflow) sequence, which is how you would write it if you were writing assembly directly. It
323.
▲
by
haberman
4y ago
Your comment is being intentionally dismissive of the grandparent's post. The false inference is that everyone who uses the word "just" is intending to be dismissive. That's what I don't like about articles like th
324.
▲
by
haberman
4y ago
And furthermore that the recipient is not capable of moderating their own perception, or communicating directly with a person who offended them to work it out.
325.
▲
by
haberman
4y ago
That was exactly my reaction when this article was last on HN: https://news.ycombinator.com/item?id=30706326
326.
▲
by
haberman
4y ago
I think the leak of thousands of authentic emails from a direct family member of a presidential candidate is newsworthy, regardless of what is in the emails. People should get to decide for themselves whether "10% for the big guy"
327.
▲
by
haberman
4y ago
Yes I am against corruption regardless of which party engages in it. Trump is as corrupt as they come, the only way he knows how to run anything is like a mob boss who expects loyalty above all. But we're commenting on a story about m
328.
▲
by
haberman
4y ago
Tens of thousands of emails recovered from the laptop turned out to be authentic, including the emails that formed the basis of the NYPost story.
329.
▲
by
haberman
4y ago
Twitter made it impossible to Tweet links to the story. A dialog box showed an error message if you tried to share the link: https://nymag.com/intelligencer/2020/10/twitter-facebook-blo... This is an extraor
330.
▲
by
haberman
4y ago
I had the same skepticism as you, but the study authors did attempt to be fair by letting a set of politically balanced laypeople (equal number Democrat and Republican) adjudicate the trustworthiness of sites. They also had journalists rat
More ›