Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
petke
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
16 ms
·
91.
▲
by
petke
11y ago
Yes that's true. Internally a lot of library types use heap allocation. Most well designed libraries avoid it if they can, but sometimes the object is simply too large for the stack. For many library types its a undocumented implementa
92.
▲
by
petke
11y ago
std::array exists. But it isnt variable length. We might get a dynarray in the next standard. I saw a standards committee panel talk where someone asked about it. Ville Voutilainen promised to write standards proposal. I dont miss it much.
93.
▲
by
petke
11y ago
Many programmers have this idea. Oh, this is a big object. I better wrap it in a smart pointer to avoid doing expensive copies when I pass it around. They do it as an optimisation. However because of named return value optimisation and move
94.
▲
by
petke
11y ago
Most often you can pass stack values to and from functions without copying. This is because of move constructors, and named return value optimization. Often its slower to use pointers (the indirection). For instance this does not do any exp
95.
▲
by
petke
11y ago
> Manual memory management is the most popular misconception of C++. Since C++11, it is now recommended to use std::shared_ptr or std::unique_ptr for automatic memory management. There is a small computational cost to maintaining referen
96.
▲
by
petke
11y ago
I don't stay in any programming job more than 2 years max. When you start at a new job you want to prove yourself. Learning the code base and the system is new and exciting and a bit scary. After two years you feel like you have a good
97.
▲
by
petke
11y ago
Free functions are fine, I prefer them also. What I mean by "C with classes" is the worst side of both languages. Type-unsafe C coding (pointers, casts., manual memory allocations, etc), with OOP (highly coupled complex class hier
98.
▲
by
petke
11y ago
On the second point I have to disagree. I worked with plenty of C++ who have been programming for years but never read a C++ book. Many of them are stuck doing hacky "C with classes" programming, much like they did from day one.
99.
▲
by
petke
11y ago
From my perspective it better and cheaper to spend a few weeks reading a well written C++ book, by one of the big names in the field. Rather than make due with some average guy who teaches C++. I wouldn't recommend any book written bef
100.
▲
by
petke
11y ago
I hope nobody gets fired for this. Probably a lots of these leaked books will be up on torrent sites.
101.
▲
by
petke
11y ago
As someone put it. I never knew, you die one piece at a time. This disease scares me. Dying, head first like that. Its common enough that it will probably happen to you or a loved one. Its easier not to think about.
102.
▲
by
petke
11y ago
At some point we should be able to code these things in (a subset) of C++. Microsoft has made C++ AMP for GPU programming. Herb Sutter has said it or something similar has a good chance of being standardised in C++ at some point. Some chat
103.
▲
by
petke
11y ago
Another option would be safety in numbers. Take a large executable written by someone else and wear its dead code like its your own skin. Hiding your true self in there somewhere.
104.
▲
by
petke
11y ago
Writing code is some ways a lot like writing in general. From the "elements of style" book: > Vigorous writing is concise. A sentence should contain no unnecessary words, a paragraph no unnecessary sentences, for the same reaso
105.
▲
by
petke
11y ago
From my fuzzy memory: To make a cpu fast you need to shrink them. To the point that the "wires" in the core are so close together that electrons jump from one another. So there is lots of electrical interference. To overcome this
106.
▲
by
petke
11y ago
Fast cores take exponentially more energy than slow ones. So the solution is to use more slow and simple cores instead. We get more performance per watt that way. On PCs we can use GPU's to make computations in parallel. I guess this i
107.
▲
by
petke
11y ago
I think moss is beautiful. I transplanted a lot of it to my stone garden (with permission from the owner of the nearby forest). In England where it rains a lot, they use chemicals to try and kill any moss in their lawns. Id be happy if my
108.
▲
by
petke
11y ago
As I understand it some things managed languages have against them; The garbage collector. Even lock free garbage collectors require some synchronization. That doesn't scale well to many cores. Another things is that low level memory l
109.
▲
by
petke
11y ago
For me it was about 2012. Herb Sutter (at MS) wrote his famous "Welcome to the jungle" article ( http://herbsutter.com/welcome-to-the-jungle ). It seemed if anyone was adapting, their platform, development tools, an
110.
▲
by
petke
11y ago
People are crafty. You dont have to have electricity at home to charge your phone. Its enough there is one power source in the village. (There was a news story about a boy that built a windmill, and the villagers paid him a bit to charge th
111.
▲
by
petke
11y ago
I think you are not hearing the point. Given that Facebook is a greedy company (and not a charity), its not going to give away free full internet. So our choice is about allowing, or not allowing, a billion poor people free Facebook access.
112.
▲
by
petke
11y ago
I agree Facebook is doing this for their own greedy reasons, but they make one very good point: "Banning free basics on the basis of net neutrality [...] means 1 billion people cant afford to access any services." It isn't a
113.
▲
by
petke
11y ago
Trying to learn more about Russian prison tattoos some time ago. There is lots of contradictory and vague descriptions on the meanings and symbolism of Russian prison tattoos on the web. At times it seems a lot like tea leaf reading. The ta
114.
▲
by
petke
11y ago
I think this is a fundamental problem with C. Both of the language itself, but also of the C programming culture of insisting on very low levels of abstractions. Bugs and undefined behaviour is too easy for programmers to write when the le
115.
▲
by
petke
11y ago
As a developer I like what MS is doing. Fragmented platforms is a programmers hell. Universal apps and the same operating system across all devices is surely the future. Most PC developers like myself wont care enough to learn a new languag
116.
▲
by
petke
11y ago
The C standard allows for many different compiler implementations. Say you set in stone and publish to your users, a certain implementation specification. You have now created a new spec. Really a new language. Your users will make programs
117.
▲
by
petke
11y ago
> I'd like to see a free C compiler that clearly defines, and permanently commits to, carefully designed semantics for everything that's labelled "undefined" or "unspecified" or "implementation-defined&
118.
▲
by
petke
11y ago
The Nordics only seems perfect from the outside. Us that live here sometimes wonder why people ever thought it was a good idea to settle here. The winters are too long and dark. The summers are too short and cold. The people are too shy. We
119.
▲
by
petke
11y ago
I'm an old movie addict and have never had cable. The cost to value ratio never made much sense to me. Even back in 98 there was ways to get movies for free or cheap on the internet. Back then it was zero day ftp's and today its s
120.
▲
by
petke
11y ago
I think there would be a better case for regulating in game purchases. Some kind of limit, or a at least a warning at the beginning so people know what they are in for. "This game contains purchasable items. You may spend more than 10
More ›