Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
nikki93
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
16 ms
·
121.
▲
by
nikki93
6y ago
For the JSON case, it doesn't make sense to use an empty object as a sentinel, for sure. JSON parsers usually have their own sentinel for `null`. Lua has a lot of issues, but `nil` being not-present hasn't been an issue that has c
122.
▲
by
nikki93
6y ago
You can just create a sentinel value and use that. eg. `local mySentinel = {}`. Then insert that value when that's the behavior you want. `nil` on its own rarely makes for a good semantic understanding of what value is actually in the
123.
▲
by
nikki93
6y ago
Tour of C++ by Bjarne Stroustrup as others have mentioned. Effective Modern C++ by Scott Meyers (esp. for the chapters on smart pointers). Arthur O' Dwyer's "Mastering the C++17 STL" David Vandervoode and Nicolai Josutti
124.
▲
by
nikki93
6y ago
The kind of stuff you are able to do with entt ( https://github.com/skypjack/entt#code-example ) like `entities.view<Position, Sprite>.each([&](auto &pos, auto &vel) { ... });` is super awesome IMO. And
125.
▲
by
nikki93
6y ago
I'd written C++ a bunch around 2006-2011 for gamedev, and jumped back into it recently and am really really loving it. I had a while in between of leaning into C which I think is important to do, to move away from the super OO based ap
126.
▲
by
nikki93
6y ago
Your stuff is awesome. :)
127.
▲
by
nikki93
6y ago
If you're writing a web server or an OS, yes you need to be careful and it might be easier to be careful in other languages (allegedly). But if you're making a game or playing around in WASM, it's fine and you're not goi
128.
▲
by
nikki93
6y ago
The reason we are in this subthread is my message about being bitten by unsigned underflow when iterating backwards using an unsigned `i`.
129.
▲
by
nikki93
6y ago
Not when it causes integer underflow.
130.
▲
by
nikki93
6y ago
Probably aboard the "hate on C" hype train. If you are curious, it could make sense to not let it get in your way, and continue investigating / learning. There's a lot to be gained from such an exercise. FWIW if you'
131.
▲
by
nikki93
6y ago
Just skimmed real quick. It actually seems p. good and I would check it out again more deeply. https://floooh.github.io/2018/06/17/handles-vs-pointers.html (and the other articles there) have some good ideas
132.
▲
by
nikki93
6y ago
coc.nvim does a lot more than linting. I know ale tries to do completion but in practice I just found the experience of using coc to be really good. It's a bunch of little things that add up. Not sure what best way to convey it -- mayb
133.
▲
by
nikki93
6y ago
No worries! And yeah I went through a phase a few months ago of trying out the completion packages again, it's worth just trying and seeing if you like it. Here's the relevant bits of my config if that helps: https://gi
134.
▲
by
nikki93
6y ago
One thing I really like in coc is I can ask to describe a symbol and it'll tell me about it in a hover thing: https://i.imgur.com/NrH0Wwz.png Do agree that coc is probably the least 'vim-culture'-ey part of s
135.
▲
by
nikki93
6y ago
It's actually quite good and runs super smoothly on my Chromebook, where VSCode was slow. I like keeping all of my vim stuff while also getting this.
136.
▲
by
nikki93
6y ago
Couldn't find an online version of the C standard with links to parts of it, but here's one for C++: http://eel.is/c++draft/support.types#layout-3 > The type size_t is an implementation-defined unsigned i
137.
▲
by
nikki93
6y ago
I think you can get far with this type of code organization, and using methods just for easier name lookup of functions associated with a particular type (static lookup -- no vtables / RTTI). Function overload sets are also useful. Lib
138.
▲
by
nikki93
6y ago
In C an index is a difference that you add to a pointer to get a pointer. `a[i]` is `*(a + i)`. Given two indices `i` and `j`, you want `i - j` to be such that `a[j + (i - j)]` is `a[i]`, and it then makes sense to me that `i - j` is signed
139.
▲
by
nikki93
6y ago
It seems sensible to always just use signed values for indices. Indices are difference types, which should include negative values so that you can subtract two indices and get a sane delta. The range of signed values seems 'big enough.
140.
▲
by
nikki93
6y ago
Hmm, I think `for (i = n - 1; i >= 0; --i)` is way clearer and maybe more common? edit: Ah unsigned underflow. :O
141.
▲
by
nikki93
6y ago
I started working on a game in Go (with Ebiten-- which is an awesome engine for native!) and hit perf issues in simple scenes that just worked flawlessly with similarly trivial code in C++ with SDL. It wasn't about the size as much as
142.
▲
by
nikki93
6y ago
As another poster said-- C++, C or Rust may give you better luck when compiling to WASM. You could also try TinyGo. Vanilla Go's embedding of its entire runtime and GC is ... a lot.
143.
▲
by
nikki93
6y ago
Glad to see some agreement there. I'm interested in building an ECS-based approach for a UI system at some point. The Yoga layout engine (implements flexbox -- https://github.com/facebook/yoga/tree/master
144.
▲
by
nikki93
6y ago
That point (keeping interactive rates) is basically one of the most important factors driving the architecture of game engines. I found this talk to be quite a good one regarding architecture for game engines (it's about the ECS in Ove
145.
▲
by
nikki93
6y ago
Being able to add / remove components then query based on component sets an entity has is an important part of ECS data driven design, which Unity is trying to move to with eg. DOTS. Just leads to less branching etc. once your data is
146.
▲
by
nikki93
6y ago
Wasn't mentioned anywhere that the input is sorted such that you could assume a binary search works.
147.
▲
by
nikki93
6y ago
Your comment said "no one writing in C has bug reduction as a priority." Bug reduction is a priority for the SQLite authors, and it's written in C. This feels to me like an indication that it is a priority: https://
148.
▲
by
nikki93
6y ago
SQLite is written in C.
149.
▲
by
nikki93
6y ago
Some UI rendering engines for games do something like this, eg. https://coherent-labs.com -- talk by one of the devs of that at https://www.youtube.com/watch?v=yy8jQgmhbAU
150.
▲
by
nikki93
6y ago
Ah yes I remember seeing this then forgot. Thanks! :D
More ›