News for hackers. Stuff that matters.

cv5005

Re:Iterating Backwards in C on Friday October 30, 2026 @01:51AM (#50300300)

  for(size_t i = count-1; i < count; --i)
'i < count' always works for unsigned, it's why I prefer unsigned for indices, only one invariant to maintain.
Re:Bring Back the Cool Save File Screens on Sunday October 25, 2026 @03:32PM (#50235242)
Can we get interesting UIs in general back? I hate all modern games with UIs (especially the fonts) that look like a generic corporate website. Yes yes, I know, accessibility, bla bla, make two versions then, should be easy enough now with AI.
Re:Anthropic builds wet lab for AI-driven drug discovery on Friday September 18, 2026 @02:34PM (#49758358)
Umbrella vs Skynet timeline race, yay!
Re:Jemalloc 5.4.0 on Friday September 18, 2026 @05:58AM (#49752150)
>where hundreds or thousands of parallel threads continuously create and destroy short-lived small and medium objects.

Should one even want a global, general purpose heap allocator for that? Seems like a crazy idea to even consider.

Re:On the Navier–Stokes Millennium Prize Problem on Tuesday September 08, 2026 @02:55PM (#49615009)
I was thinking something along the lines of making a mistake when inputing the initial statement, like you wanted to prove that '2 is even' but what you actually stated was that '3 is odd'.

Of course in this simple example it's obvious, but my assumption was that these machine generated lean proofs are millions of lines of code and who knows what they actually say..

Re:On the Navier–Stokes Millennium Prize Problem on Tuesday September 08, 2026 @01:46PM (#49613839)
Maybe a naive question, but how does one know that a particular lean proof is actually a proof of what one thinks? Like, ok the logic checks out and it proves something, but there's still the problem of does this logical result actually prove the initial question that was asked?
Most people in the world wants some form of ethnic cleansing - that's why you get 'ethnic quarters' in most large cities, people generally like to be around their own 'kind'.
Current LLMs don't pass the turing test.

Remember, the interrogator is allowed to be hostile, so they would obviously employ all known prompt injections and typical LLM 'gotchas' to figure out who the AI is.

Re:Sp.h is the standard library that C deserves on Saturday May 23, 2026 @08:47PM (#48253159)
>There's no namespacing feature provided so you're left with the convention of picking a few letters as a prefix and hoping it doesn't overlap and yet is succinct enough to not be annoying.

I've been using C on a daily basis for 30+ years and name collisions has just never been a problem.

Granted, it might be due to lack of a package manager so micro dependencies ala import is_even is not a thing here, but still, in practice, no name collions occurs.

Re:Project Hail Mary – Stellar Navigation Chart on Thursday May 21, 2026 @02:18PM (#48226894)
Chinese film having 100% chinese cast = good.

American film having a single white male lead = not good.

Never quite understood why people are so obsessed with meta programming capabilities in a language, be it templates, comptime, macros, whatever.

I program mostly in C, if I need 'meta' programming I just write another C program that processes C source code (I've written a simple C parser), then in my build script I build in two stages, build meta program, run it, build rest of program.

Simple, effective, debuggable (the meta program is just normal C), infinite capabilities - can nest this to arbitritary depths, need meta-meta programming? Make a program that generates a meta program.

>One need to write it manually each time in each function where some cleanup is needed.

You can structure your code to not need cleanup in every function.

The biggest problem with destructors is, how do you handle errors? close() can fail you know?

One reason is that c++ still hasn't gotten 'trivial relocatability' right - i.e being able to memcpy/memmove and not have to call constructors/destructors when growing your vector class.
Yeah I dont think a single current LLM would fool me in a turing test - I would obiously use all kinds of prompt injection techniques, ask about 'dangerous' or controversial topics, ask about random niche facts in varied fields, etc.
std span is not bounds checked.
Re:Big-Endian Testing with QEMU on Saturday April 04, 2026 @03:41AM (#47636818)
Having different types seems wrong to me because endianess issues disappears after serialization, so it would make more sense to slap an annotation on the data field so just the serializer knows how to load/store it.
Re:Windows native app development is a mess on Sunday March 22, 2026 @09:18AM (#47477218)
This was an MFC project, so your old standard win32 common controls that looks the same since 98 or so.
Re:Windows native app development is a mess on Sunday March 22, 2026 @09:16AM (#47477201)
Well it's still a 32 bit program so I guess that helps. Would probably require some porting to make it 64 bit native, but as long as you use the WPARAM, INT_PTR typed and what not correctly it 'should just work'.
Re:Windows native app development is a mess on Sunday March 22, 2026 @09:05AM (#47477098)
I'm an embedded programmer who occassionally needs to write various windows programs to interface with embedded devices (usually via serial port or usb), and I find it a breeze to write native gui programs in pure win32 and c++.

Recently had to add a new feature to and old program that was last updated in the XP era and two things to note:

1. The program did not need to be updated to run on Vista, 7, 10 and 11, shit just kept working throughout the years.

2. I loaded the project into Visual Studio 2022, it converted from VC6 and compiled without problems, added the feature, shipped a new .exe to the customer, and it just worked.

What other platform has that backwards and forwards compatibility success story?

Re:Methods in Languages for Systems Programming (2023) on Monday March 16, 2026 @04:09PM (#47404199)
Not a fan of methods.

Why should the first argument be so special? And how do you decide which struct should get method if you have a function that operates on two different types?

Re:The Lobster Programming Language on Sunday March 08, 2026 @09:32AM (#47297189)
Eventually it wont need to write any code at all. The end goal for AI is "The Final Software" - no more software needs to be written, you just tell the AI what you actually want done and it does it, no need for it to generate a program.
Re:Best Performance of a C++ Singleton on Sunday March 08, 2026 @09:21AM (#47297119)
>Then there's the static initialization order fiasco

One of the reasons I hate constructors and destructors.

Explicit init()/deinit() functions are much better.

Is it? rust has to ditch llvm to be able to replace c++ - or rewrite llvm in rust.
Re:How many registers does an x86-64 CPU have? (2020) on Saturday February 14, 2026 @11:48AM (#47015992)
A good compiler will only do that if the register spilling is more efficient than using more stack varibles, so I don't really see the problem.
Re:LLMs could be, but shouldn't be compilers on Friday February 06, 2026 @10:37AM (#46914125)
Bitwise identical output from a compiler is important for verification to protect against tampering, supply chain attacks, etc.
Re:We tasked Opus 4.6 using agent teams to build a C Compiler on Thursday February 05, 2026 @03:18PM (#46904608)
That's because you need to implement a bunch of gcc-specific behavior that linux relies on. A 100% standards compliant c23 compiler can't compile linux.
Re:Advancing AI Benchmarking with Game Arena on Monday February 02, 2026 @01:27PM (#46859389)
My personal threshold for AGI is when an AI can 'sit down' - it doesn't need to have robotic hands, but it needs to only use visual and audio inputs to make its moves - and complete a modern RPG or FPS single player game that it hasn't pre-trained on (it can train on older games).
Re:Aliasing on Monday December 22, 2025 @02:01PM (#46357485)
For systems programming the correct way is to have explicit annotations so you can tell the compiler things like:

    void foo(void *a, void *b, int n) {
        assume_aligned(a, 16);
        assume_stride(a, 16);
        assume_distinct(a, b);
        ... go and vectorize!
    }
Re:Data breach at major Swedish software supplier impacts 1.5M on Tuesday November 04, 2025 @03:21PM (#45815459)
This data is publically available to anyone in Sweden:

Your salary (well, last years taxable income), debts/credit rating, criminal history, address, phone number, which vehicles and properties you own and which company boards you're on.

One of organized criminals biggest income these days are scamming rich old folks because it's so trivial to get all details needed (and who to target) to be a pretty convincing bankman, IRS type agent/etc.

Some of it you have to kind of manually request at various places, but it's all available.

So data breaches aren't really that big of a deal when everything is already public.

Re:Fil-C: A memory-safe C implementation on Sunday November 02, 2025 @02:36PM (#45792782)
You don't have to do int2ptr for mmio or absolute addresses, you can punt that to the linker.

    extern struct uart UART0;
Then place that symbol at address X in your linker script.

Older »