3 ms·
Old, well-known feature of one of the most popular languages. I must be missing something, because I have no idea how this became a hacker "news" :)
by mbel 7y ago
Old, well-known feature of one of the most popular languages. I must be missing something, because I have no idea how this became a hacker "news" :)
- mikeash 7y agoHacker News Guidelines What to Submit On-Topic: Anything that good hackers would find interesting. That includes more than hacking and startups. If you had to reduce it to a sentence, the answer might be: anything that gratifies one's intellectual curiosity.
- entelechy0 7y agoyeah, people don't realize that not everyone knows everything already
- asveikau 7y agoIt's not technically a feature of the language, as it is not standardized and is compiler-specific. But thing you are talking about indeed recurs here. The way I typically guess is that new generations of programmers are coming up all the time and may be unfamiliar with some old stuff. Or, maybe even some experienced people who never happened to touch c or c++ [there are more of those as time goes on].
- AdmiralAsshat 7y agoI'm scratching my head, too. I could've sworn the Linux kernel itself had a few chunks of hand-written assembly for better performance in key spots. EDIT: I see several, just from doing a simple search against 'movq' https://github.com/torvalds/linux/search?q=movq&unscoped_q=movq https://github.com/torvalds/linux/search?q=movq&unscoped_q=m... I am not a kernel programmer, though, so I can't say whether it's being used in any capacity on modern, x64 systems or whether it's a compatibility mode for low-powered embedded architectures. Maybe someone more knowledgeable can chime in.
- asveikau 7y agoIn the case of the kernel it's not just a performance thing. There are a lot of things that are totally irrelevant to the high level notion of the C execution model that are therefore not exposed, and certainly not in the C standard. Things like: Hm, I need to swap my stack register and page table with this other process. Or writing interrupt handlers. Atomic operations and memory barriers used to be one of those things, but compiler extensions and new language standards have been catching up on some of that... Though to be honest a kernel will want enough control that it will likely still go outside the standard or extra compiler support for these anyway.