496 karma · joined Sep 10, 2025 (1y ago) · 497 submissions
comment 17h ago · link · parent
Memory safety, race conditions, unhandled integer overflows. Look at all newly-discovered vulnerabilities, they almost all caused by these issues.
> Some of the C pains are hard to solve without breaking the language.
That's why it's necessary to do such breaking change, to stop using C and to switch to better languages having no issues mentioned above.
comment 17h ago · link · parent
It would be better to handle panic as termination of the whole process. Ideally it can be achieved by single instruction like ud2 allowing the OS doing the job.
comment 18h ago · link · parent
comment 1d ago · link · parent
Something is terribly-wrong with the standardization committee if such useful feature as labeled loops (proven to work fine in other languages for decades) are still not in the standard, but questionable things like std::regex or contracts are.
comment 2d ago · link · parent
In my recent project I linked SDL2 statically and disabled all unnecessary components, so that it doesn't add much to the result executable size. In seems to be more practical to do so, rather than ditching it entirely.
comment 4d ago · link · parent
If you use mostly unsigned values it's not a huge problem, as long as you don't perform subtractions or operations with possibility of overflow. If obtaining a negative value or getting an overflow may occur, you should perform proper checks before calling an API function. And in case of WinAPI or something similar usually no extra computations before a call are necessary, arguments are already precomputed (like with buffer sizes).
comment 4d ago · link · parent
Chromium-based applications consume so much memory, not because they don't use manual memory management, but because JS used for application code isn't nearly as efficient in memory usage as any other proper language. Also the browser engine itself is optimized in such a way, that it sacrifices memory usage to gain more speed.
comment 4d ago · link · parent
11.
Unit-testing in the Ü programming language(panzerschrek.github.io ↗)
14 points · by Panzerschrek · 5d ago · 3 comments
comment 1w ago · link · parent
In OpenGL mode colored lighting is there. But map designers overused it too much, especially in outdoor locations having yellow sky lighting, which looks somewhat depressive.
comment 1w ago · link · parent
Ergo memory leaks.
> arena and pool allocators
A poor's man replacement for RAII.
> go style err!=nill style exception handling
Literally the most criticized part of Go.
> first class support for defer statements
Again, defer is used, because there is no RAII.
> consider it
No, thanks. I will continue using Rust or even C++. I don't want wasting time debugging memory leaks and corruptions.
comment 1w ago · link · parent
That's why I think having unwinding in Rust is a mistake. It gives a false sense of safety, but it's very hard to write unwinding-correct code. So, it would be better to handle panics as immediate process termination instead.
comment 1w ago · link · parent
It's basically debug information. Why not putting it into a separate file?
comment 1w ago · link · parent
to what extent is it safer than C? Does it eliminate safety issues common to C like out of bounds memory access, use-after-free, double-free, race conditions? Or maybe some other kind of safety issue present in C isn't possible in Micron?
> unsafe parts are explicit
Does it have unsafe blocks or something similar?
comment 1w ago · link · parent
There is only one logical step left - make such scanning mandatory. Even better would be to perform proper audit with real humans involved. In order to cut down costs of such measures, there should be some limit on how often a package may be updated, let's say, once in a week.
comment 2w ago · link · parent
It has no way to specify custom alignment. So, if more than 8 or 16-bytes alignment is needed, custom user-code tricks are necessary (allocate more than necessary, round up).
It has no way to report how many bytes are actually allocated. Sometimes it may be useful, like if I reserve 9 bytes for a string and underlying allocation granularity is 16 bytes, I want to know that I can increase string size up to 16 bytes without calling malloc again.
It's a single entry point allowing no allocation size customizations. So, if I allocate objects of fixed size, I still need to pass a dynamic size parameter to malloc and it needs to perform branching in case if it does have some optimizations for particular sizes.
free has no size parameter, which is a mistake. This forces the allocator to maintain size values somewhere inside, which is often an unnecessary overhead, since user code already knows size (like for fixed-size allocations or containers storing explicit capacity).
With interface fixes described above a malloc implementation can be much more performant and (sometimes) even easier to use.