HNHacker News
TopNewBestAskShowJobs

kevinnk

799 karma · joined March 25, 2012

[ my public key: https://keybase.io/kkiningh; my proof: https://keybase.io/kkiningh/sigs/i245-gK_dv4Qc5VWTlErrKFhl9_TEsxfD3WbLDeD4As ]
submissionscomments
kevinnk··on Learn C and build your own Lisp
It's hard to generate high quality error messages with current generators unfortunately. More common nowadays is building first with a generator and switching to recursive decent when it becomes too unwieldy.
kevinnk··on Leaked: Harvard’s Grading Rubric
It's a joke.
kevinnk··on Intel i7 loop performance anomaly
Many ARM processors are in order. Also Itanium.
kevinnk··on Self-driving cars projected to reduce injuries by 90%, save $450B annually
I think a solution for this would be to have the "self driving" speed limit be 10-15mph faster then the normal limit on highways. Since driverless cars can react faster this wouldn't cause more accidents and it would allow driverless cars to keep up with traffic. Plus, if traffic slows there's nothing stopping the driverless car from slowing down as well.
kevinnk··on Less is exponentially more (2012)
> The only language I know, which explicitly targets C++ is D, but it is not there yet completely. Though, depending on your needs it might enough and it is an improvement over C++.

And Rust. Although it has its own issues as well.

kevinnk··on AMD reveals roadmap for ARM and x86 SoCs
While this would be cool, I'm not exactly sure under what circumstances this would be useful.
kevinnk··on Yahoo says U.S. sought data on 40,332 user accounts in 2013
> "Still, though, even if only ten percent of these are related to national security, that's four thousand threats to our security last year--from Yahoo!'s user base alone."

The problem with this line of reasoning is that are numbers less than %10 - it's perfectly possible that there was only 1 NSL and the Yahoo! announcement wouldn't read any differently.

kevinnk··on Don't Fly During Ramadan
Really? I just asked 5 people around me. None of them have ever had an American history class that covered WW2 and not cover the internment camps.
kevinnk··on Why I should have written ZeroMQ in C, not C++ (2012)
> The notion that poor memory cache efficiency is inherent with GC's is not terribly well founded.

It may not be "inherent" to GC, but in practice every GC that I'm aware of has terrible cache efficiency compared to manual memory management.

> Copying collectors (like the one the HotSpot VM uses for Eden Space) tend to have great cache efficiency as compared to typical use of the C heap

False comparison. The real test is against high performance memory techniques (like memory pools, which are relatively easy and common in practice if you care at all about cache efficiency) not "typical use of the C heap." When you actually compare GC vs high performance manual memory management, manual memory management is significantly faster.

kevinnk··on XKeyscore: NSA program collects 'nearly everything a user does on the internet'
The point is more that for most lawmakers there's not really a need to read all of the nitty gritty legal language. If you're a House Rep from Kansas who's core issue is corn subsidies, reading all of the PATRIOT Act isn't really going to do you much good. Instead, you read the summaries and listen to the opinion of the experts in your party who have read the whole act.

It's important too to note that this isn't a "big law" or even an American thing. Virtually all bills of any substance work this way and it's pretty much standard practice in most countries.

That being said, I'm not defending the PATRIOT Act. I just think the argument that not enough people read it is weak, especially considering all the real arguments you can make that actually attack the substance of the act.

kevinnk··on XKeyscore: NSA program collects 'nearly everything a user does on the internet'
>It was obvious from the length of the act alone that even Congressional staffers couldn't have read it carefully between the time of submission and the time it passed.

This is a little off topic, but I always see this trotted out when people talk about big laws (like Obamacare, PATRIOT Act, etc) and it's not really true. Lawmakers usually work with and read a "normal language" version of laws that then gets transformed into a stricter legal version by staffers and experts. They will look at the actual legal version of the law if they care about a specific rule or section, but they usually don't need to.

kevinnk··on The Vitamin Myth: Why We Think We Need Supplements
Vitamin D enrichment is required for most milk in the USA, and according to wikipedia virtually all first world countries have a similar law.
kevinnk··on Detroit Is Going Bankrupt, But Its Tech Community Is Going Strong
I'm from Ann Arbor and have lived in New York. The tech scene in Ann Arbor is quite strong, especially considering its only a town of 110k or so. Most of our startups and incubators are centered around the university, so I would recommend at least living close by. Its an amazing place to grow up or start a family in too.
kevinnk··on Pay No Attention to the Bloody Corpse in the Bathroom
Assuming we're talking about the "other" UofM, I would hardly call what happened "doing nothing about it." It was almost certainly an egregious failure on the part of a couple individuals, but it was more about a lapse in protocol then a university cover up. Not to mention that UofM has completed two separate independent reviews of what happened and made a pretty big (and public) effort to fix it.
kevinnk··on Bitcoin In IRS Crosshairs
Something doesn't have to be legal tender to be taxed. If I'm a home builder I don't avoid paying taxes by being payed in, say, a house rather than USD. I still have to report it as income.
kevinnk··on Bitcoin In IRS Crosshairs
Citation needed, I'm not a tax expert but based on what advice I've previously been given and on http://www.irs.gov/Individuals/International-Taxpayers/U.S.-... I'm pretty sure that's not true.
kevinnk··on Massive Number of Vulnerabilities Found in X.Org
> For the same reason we trap on integer division by zero.

We trap on division because it is objectively a programmer error that has no obvious right answer. Division is also a relatively expensive and much less common operation for the cpu. The overhead of adding trapping is much smaller compared to addition. Furthermore, integer overflow has an easy solution: widen the computation. Divide by 0 has no quick answer.

> I think if we counted the number of + operations in a typical C program and multiplied that by the instruction(s) needed to implement a conditional branch path (often never taken dead code), it would be nontrivial. This overhead should be easily measurable on benchmarks.

A consistently not taken branch has very, very close to 0 overhead in a modern processor. Not to mention that adding trapping to addition would hinder things like instruction reordering and speculative execution, which adds an overhead that can't be disabled when overflow can provably not occur or not matter. The cpu would also have to treat unsigned and signed addition differently, which means an additional opcode, which adds complexity to the control logic and decreases code density. Finally, there are plenty of languages and libraries which do almost exactly what you propose and automatically widen variables when they overflow and do not experience significant slowdown.

>I'm not arguing against the ability to do that, but I think those cases are far less common.

You are wrong. Consider the pointer arithmetic expression "ptr += x;" on a cpu that has two trapping add instructions (add unsigned and add signed) and ptr is a pointer and x is a signed value. Note that this is extreamly common for things like array access. Suppose the compiler generated an unsigned add. If the ptr value was 0x1 and x was -1 that would generate an overflow because 0x00000001 + 0xFFFFFFFF results in an unsigned overflow. Suppose it instead generated a signed add. If the ptr value was 0x7FFFFFFF and x was 1 this would also generate an overflow because 0x00000001 + 0x7FFFFFFF results in signed overflow. To resolve this you would need 4 different instructions, which would only get worse as you add various operand lengths to the mix. Now I wouldn't say this is a problem for a majority of add instructions, but adding a signed and unsigned number is a very common operation. In addition, if you actually look at generated assembly code, many of the add instructions do not correspond to a '+' but instead do things like stack management or pointer offset adjustment which do not care about overflow because they can be proved to not occur.

> To allow compilers (not just C) to emit safer code by default by removing the small but measurable instruction penalty.

Again, there is virtually no overhead on a modern out of order, branch predicting processor. And adding trapping does have an overhead, a significant one, that cannot be removed when overflow can be proved to not occur or isn't important.

As a final argument, consider this: of all the major cpu architectures I've studied (MIPS, x86, ARM) not a single one has a trapping add instruction. Very smart people have also considered this problem and have come to the same conclusion: trapping is bad and should only be used in truly exceptional circumstances where no recovery is obvious. I agree with you that integer overflow is a big problem in languages like C that do not have a good way to detect it. However, this is truly a language only problem NOT a cpu one.

kevinnk··on Massive Number of Vulnerabilities Found in X.Org
I think you may not have understood my question. It is _trivial_ to detect integer overflow in virtually every major cpu I've ever seen. x86, ARM, PPC, MIPS, and many, many more all support this in a single instruction. Trapping, on the other hand, is extreamly expensive in modern processors, on the order of tens of thousands of cycles wasted. Furthermore, there are many cases where integer overflow is actually desired. My question is would be why would a cpu trap be a better solution than what we already have?
kevinnk··on Massive Number of Vulnerabilities Found in X.Org
No one said that... -Werror is good when you are developing, not when you are compiling someone else's code.
kevinnk··on Massive Number of Vulnerabilities Found in X.Org
Because in the vast majority of cases you don't need to and it would unnecessarily slow down a lot of legitimate computation? You can already detect integer overflow extremely easily, why would the cpu need to trap?
kevinnk··on Introduction to AVX2 optimizations in x264
Um, unless I misunderstand your question, virtually all of them do. In particular, GCC, Clang/LLVM and ICC all do instruction scheduling.
kevinnk··on Ask PG: Has HN ever received a DMCA Takedown Notice?
There are penalties for filing a false take down notice. See page 12 of http://www.copyright.gov/legislation/dmca.pdf

"In order to protect against the possibility of erroneous or fraudulent notifications, certain safeguards are built into section 512. Subsection (g)(1) gives the subscriber the opportunity to respond to the notice and takedown by filing a counter notification. In order to qualify for the protection against liability for taking down material, the service provider must promptly notify the subscriber that it has removed or disabled access to the material. If the subscriber serves a counter notification complying with statutory requirements, including a statement under penalty of perjury that the material was removed or disabled through mistake or misidentification, then unless the copyright owner files an action seeking a court order against the subscriber, the service provider must put the material back up within 10-14 business days after receiving the counter notification.

Penalties are provided for knowing material misrepresentations in either a notice or a counter notice. Any person who knowingly materially misrepresents that material is infringing, or that it was removed or blocked through mistake or misidentification, is liable for any resulting damages (including costs and attorneys’ fees) incurred by the alleged infringer, the copyright owner or its licensee, or the service provider. (Section 512(f))"

kevinnk··on Programming languages ranked by expressiveness
But that's not true if there is a systemic bias involved that has nothing to do with expressiveness. If you're more likely to make small commits on "fun" projects, you're biasing the results against languages that aren't used as often in fun projects.
kevinnk··on Programming languages ranked by expressiveness
Vala and C# are two very similar langauges that are on polar opposite sides of the chart. Why? If I can't answer that in a convincing way, my first thought is going to be "because there is another factor involved in the rankings that wasn't accounted for."
kevinnk··on Programming languages ranked by expressiveness
But that's a really important issue that I think deserves a lot more than two lines if you really want to convince anyone. For example, let's say I don't think that assumption is valid because adding or changing a feature in a large project is a lot more likely to involve refactoring than in a small project, regardless of how expressive the language is. This would bias your results against languages that are more commonly used in large projects. Maybe that's an issue, maybe not, but as far as I can tell you haven't even considered it (and saying "it probably averages out" isn't a real response.) Without some sort of justification for your assumptions I have a hard time believing your results.
kevinnk··on Programming languages ranked by expressiveness
I agree, for all the time he spends on his results, as far as I can tell he never really defends the idea that commit size is in any way a good proxy for "expressiveness." It would be nice if he could explain why he chose commit size over somthing like rosetta code size or some other metric.
kevinnk··on Just Use Sublime Text
I used to use nano, and for me it was the fact that every one else seemed to love vim, so I felt like I should at least try it out. Honestly, it takes about 20 minutes, max, to get to the level of being able to do what nano can do in vim. And if you want something more, it's not very hard to learn after you get the vim basics. I'm not going to say it's for everyone (especially if you're already used to a full IDE) but I would encourage anyone who's at least a little interested in trying it out for a day.
kevinnk··on SimCity’s Sims Don’t Seem That Smart After All
"There were no congestion problems like in SimCity 5 in older versions because cars didn't try to get from point A to point B."

That's not really true. Sim City 4 did have congestion problems and it did simulate Sims going from point A to B. It wasn't as granular as SC5 simulating individual cars, but it did simulate groups of Sims traveling to and from work. It was also infamously buggy (something the modding community spent a lot of effort fixing) but it still was better than what we have now.

kevinnk··on Why Clarence Thomas Uses Simple Words in His Opinions
Actually, a lot of laws are written this way with a "English" version that most lawmakers read and a "legal" version that actually becomes law.
kevinnk··on Google Go: The Good, the Bad, and the Meh
You could have something like * [* FooType#4]
← PreviousPage 7 of 8Next →