Readit News logoReadit News
mbel commented on I've been writing ring buffers wrong all these years (2016)   snellman.net/blog/archive... · Posted by u/flaghacker
andrepd · 9 days ago
> C++ has std::bitset and std::vector

Notably, this is not the case. C++ std::vector is specialised for bools to pack bits into words, causing an untold array (heh) of headaches.

And "wasteful" is doing a lot of lifting here. In terms of memory usage? Yes. In terms of CPU? The other way around.

mbel · 9 days ago
> In terms of CPU? The other way around.

That depends on your architecture and access pattern. In case of sequential access, packed bools may perform better due to arithmetic being usually way cheaper than memory operations.

mbel commented on APT Rust requirement raises questions   lwn.net/SubscriberLink/10... · Posted by u/todsacerdoti
stingraycharles · a month ago
Seems like a fairly decent syntax. It’s less simple than many systems languages because it has a very strong type system. That’s a choice of preference in how you want to solve a problem.

I don’t think the memory safety guarantees of Rust could be expressed in the syntax of a language like C or Go.

mbel · a month ago
> It’s less simple than many systems languages because it has a very strong type system.

I don’t think that’s the case, somehow most ML derived languages ended up with stronger type system and cleaner syntax.

mbel commented on I spent the day teaching seniors how to use an iPhone   forums.macrumors.com/thre... · Posted by u/dabinat
boplicity · 3 months ago
Gotta strongly disagree on this. For example, I know there's a way to get to the app switching screen, which shows all of the apps in a grid. You just have to drag up from the bottom the right amount in order to get the grid to stay. Despite knowing this, I fail to do it half the times I try. I just can't figure out how much to "drag" up from the bottom. Too much or too little and it just doesn't work. So frustrating. And so many other similar examples.
mbel · 3 months ago
In this case there is both time a distance limit to the gesture. If the gesture is too fast the switcher won’t appear even if the distance was long enough.

That said, personally I’ve always found the gesture navigation very intuitive.

mbel commented on Sj.h: A tiny little JSON parsing library in ~150 lines of C99   github.com/rxi/sj.h... · Posted by u/simonpure
mbel · 3 months ago
It feels like a stretch to call this a parser. It’s looks like a typical lexer?
mbel commented on Show HN: A new programming language inspired by Go, no LLVM   github.com/nature-lang/na... · Posted by u/hualaka
intalentive · 7 months ago
Why should I care whether LLVM is used? What’s the advantage?
mbel · 7 months ago
Probably the compilation time is better than it would be with LLVM. On the other hand I doubt that codegen and therefore performance is on par with LLVM.

Definitely a weird thing to advertise.

mbel commented on Open-source interactive C tutorial in the browser   learn-c.org/... · Posted by u/Buttons840
hahn-kev · 8 months ago
The problem (as mentioned above) is that c99 is not the same everywhere.
mbel · 8 months ago
This is mostly an issue with MSVC which refuses to become compliant with c99 standard. Their support for c11 and c17 also has some gaps around features that were introduced in c99.
mbel commented on How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2   cookieplmonster.github.io... · Posted by u/yett
gavinray · 8 months ago
Rust protects you from external file data you read being incorrect?

That's one hell of a language!

mbel · 8 months ago
Most popular languages would prevent this. In this case it’s as simple as having more sensible reader API than sscanf in standard library and forcing variables to be initialized.
mbel commented on C++: terser (shorter) lambda == SHORTY (ab-use?)   github.com/hanickadot/sho... · Posted by u/signa11
porridgeraisin · 9 months ago
That's horrifying
mbel · 9 months ago
To be honest the implementation looks surprisingly readable… at least compared to other horrors like the standard library implementation.

While there are some new rules regarding arguments naming, the new syntax doesn’t feel more complex than the default lambda syntax.

So all in all I would say the most horrifying thing here is the fact that the language allows such extensions in the first place ;)

mbel commented on Performance of the Python 3.14 tail-call interpreter   blog.nelhage.com/post/cpy... · Posted by u/signa11
bjourne · 10 months ago
This is exactly the kind of content I love to see on HN. But I wonder though how this optimization is related to tail-call optimization? How the interpreter jump table is implemented shouldn't affect how stack frames are created, should it?
mbel · 10 months ago
It's explained under the first link from the article [0]:

"A new type of interpreter has been added to CPython. It uses tail calls between small C functions that implement individual Python opcodes, rather than one large C case statement."

[0] https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-...

mbel commented on Don't "optimize" conditional moves in shaders with mix()+step()   iquilezles.org/articles/g... · Posted by u/romes
NohatCoder · a year ago
It may very well be, it is the type of optimisation where it is quite possible that some compilers may do it some of the time, but it is definitely also possible to write a version that the compiler can't grok.
mbel · a year ago
Yup, they most likely do. After all everything is LLVM based nowadays.

u/mbel

KarmaCake day1302October 26, 2011
About
http://belickim.net
View Original