News for hackers. Stuff that matters.

neonz80

Re:Four Months of Zig on Wednesday October 28, 2026 @07:35PM (#50282458)
Not every function returnds a boolean. It is probably easier to write HANDLE file = CreateFile(...) than to send in a pointer to HANDLE. Also, this is exactly the same as what libc does with syscalls on Linux etc.
Re:Websites are closing their doors to AI agents on Sunday October 18, 2026 @01:55PM (#50143512)
1GB of logs, not content
kernel32 is an official API, you're probably thinking of ntdll. CRT is the C-runtime. Not everything is written in C.
Re:Fasttracker II clone in C using SDL 2 on Sunday August 02, 2026 @12:27PM (#49145943)
The first version of the FT2 clone was released 7 years ago.
Re:The PImpl idiom and the C++26 std:indirect type on Friday July 24, 2026 @03:47AM (#49032403)
They didn't add PImpl support, they added std::indirect which can be used for PImpl among other things.
Re:A stray "j" ruined my evening on Sunday June 28, 2026 @06:17AM (#48706050)
Impossible, Signal TUI is written in Rust.
> Windows users singling out Linux users for not catering to their platform. How the times change...

In my experience this was a problem over 25 years ago when I developed for Solaris and other non-Linux operating systems.

Re:C64: Putting Sprite Multiplexing to Work on Tuesday March 03, 2026 @05:24PM (#47239956)
If you put both handlers in the same 256 byte page you can get away with only updating the low byte of the address.
Why an extra DLL instead of just patching the game executable? With some luck it is a one byte patch (from push 0 to push 4).
Re:C++: A prvalue is not a temporary on Thursday November 06, 2025 @05:51PM (#45841475)
I find that this can reduce overall complexity. It makes it possible to use objects that can not be copied (such as a file descriptor wrapper) and moving can in most cases not fail. Without move semantics you'd have to use smart pointers to get similar results but with extra overhead.
Re:When O3 is 2x slower than O2 on Sunday November 02, 2025 @08:47AM (#45790336)
I'm aware of how they are used, but fundamentally there is nothing with the words "array" and "vector" that says that one has a fixed size and the other has a dynamic size. If anything, it should be the other way around. Using the name vector for dynamic arrays is annoying when doing any kind of math coding. Even the designer of STL says the name was a mistake.
Re:When O3 is 2x slower than O2 on Sunday November 02, 2025 @08:05AM (#45789998)
I find the short type names for integers and float hard to read. Somehow the size of the type is more important than if it is a signed integer, unsigned integer or a floating point number.

Using Vec for arrays is also annoying, repeating the mistake from C++.

RobWords made a video about it a few weeks ago! https://youtu.be/UAT-eOzeY4M
Re:Async/Await is finally back in Zig on Saturday November 01, 2025 @03:29PM (#45784564)
You should take a look at the presentation I mentioned elsewhere in this thread. You also have to keep in mind that it's not only the branches that use space, but also the error handling code. Code which must be duplicated for every single call to a particular function.
Re:Async/Await is finally back in Zig on Saturday November 01, 2025 @02:55PM (#45784284)
The CPU can not remember an infinite number of branches. Also, many branches will increase code size. With exceptions the unwind tables and unwind code can be placed elsewhere and not take up valuable L1 cache.
Re:Async/Await is finally back in Zig on Saturday November 01, 2025 @01:00PM (#45783266)
That's a different type of overhead than having unwind tables. With exceptions you wouldn't need a branch after each function call at all.
Re:Async/Await is finally back in Zig on Saturday November 01, 2025 @12:36PM (#45783042)
There was an interesting talk about C++ exceptions in smaller firmware at CppCon last year: https://youtu.be/bY2FlayomlE

Basically, the overhead of exceptions is probably less than handling the same errors manually in any non-trivial program.

Also, it's not like these table doesn't exist in other languages. Both Rust and Go have to unwind.

Re:I write type-safe generic data structures in C on Monday June 30, 2025 @05:49PM (#44428278)
I'm not sure about other compilers, but compiling C code as C++ with MSVC ends up with pretty much the exact same code, instruction by instruction. C++ is a bit more strict though especially with casting, so a lot of code won't compile out of the box.
I do not find the Retrotink 4k any less configurable than the OSSC (non-pro, I haven't tried the pro). Note that the 4k is nothing like the 5X-Pro which is more plug and play.
Re:The Hall SC-VGA-2 Video Processor, the Atari ST and NeXTSTEP on Saturday November 30, 2024 @09:59AM (#42281966)
I've been using the OSSC to upscale a 50 Hz RGB signal (SCART) to 1024x1024 (256 lines duplicated 4x). Both my HDMI capture cards happily accept that resolution with the right software.

I haven't tried the OSSC Pro, but the Retrotink 4k should probably also work fine and is really easy to use. A bit on the expensive side though...

Re:The Byte Order Fallacy on Friday September 20, 2024 @06:08PM (#41605940)
The compiler can optimize this. See https://gcc.godbolt.org/z/hxW7hhrd7

  #include <cstdint>
  uint32_t read_le_uint32(const uint8_t* p)
  {
      return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
  }
ends up as

  read_le_uint32(unsigned char const*):
          mov     eax, dword ptr [rdi]
          ret
This works with Clang and gcc on x86_64 (but not with MSVC).
Re:Removing stuff is never obvious yet often better on Monday August 26, 2024 @11:17AM (#41357971)
I guess Ethereal is available :)
I put my CPU code up here: https://github.com/neonz80/shallenge-x86 . It requires an x86 CPU with the SHA256 extension.

It manages 1.1 GH/s on an Intel i7-13700K.

You can probably get a 2x speedup by shortening the string so that it fits in one block.
Re:Show HN: SHAllenge – Compete to get the lowest Hash on Saturday June 22, 2024 @05:58PM (#40762568)
I'm a bit late to the game, but I managed to squeeze out about 1 GH/s on an i7-13700K.