frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

XSLT – Native, zero-config build system for the Web

https://github.com/pacocoursey/xslt
255•_kush•7h ago•168 comments

I Switched from Flutter and Rust to Rust and Egui

https://jdiaz97.github.io/greenblog/posts/flutter_to_egui/
105•jdiaz97•3d ago•36 comments

Parameterized types in C using the new tag compatibility rule

https://nullprogram.com/blog/2025/06/26/
57•ingve•6h ago•17 comments

Show HN: Zenta – Mindfulness for Terminal Users

https://github.com/e6a5/zenta
43•ihiep•3h ago•10 comments

PJ5 TTL CPU

https://pj5cpu.wordpress.com/
20•doener•5h ago•1 comments

AlphaGenome: AI for better understanding the genome

https://deepmind.google/discover/blog/alphagenome-ai-for-better-understanding-the-genome/
467•i_love_limes•22h ago•149 comments

Calculating the Fibonacci numbers on GPU

https://veitner.bearblog.dev/calculating-the-fibonacci-numbers-on-gpu/
14•rbanffy•3d ago•7 comments

Launch HN: Issen (YC F24) – Personal AI language tutor

280•mariano54•21h ago•245 comments

A Lisp adventure on the calm waters of the dead C (2021)

https://mihaiolteanu.me/language-abstractions
24•caned•3d ago•1 comments

Moonbase Alpha: That time NASA made a meme video game

https://www.spacebar.news/moonbase-alpha-nasa-video-game/
16•todsacerdoti•3d ago•5 comments

Sailing the fjords like the Vikings yields unexpected insights

https://arstechnica.com/science/2025/06/this-archaeologist-built-a-replica-boat-to-sail-like-the-vikings/
65•pseudolus•3d ago•11 comments

Alternative Layout System

https://alternativelayoutsystem.com/scripts/#same-sizer
272•smartmic•16h ago•35 comments

The time is right for a DOM templating API

https://justinfagnani.com/2025/06/26/the-time-is-right-for-a-dom-templating-api/
155•mdhb•16h ago•129 comments

Apple Will Transition from the CTF to the CTC for EU Businesses

https://developer.apple.com/news/?id=awedznci
35•eXpl0it3r•5h ago•13 comments

“Why is the Rust compiler so slow?”

https://sharnoff.io/blog/why-rust-compiler-slow
212•Bogdanp•16h ago•249 comments

Biomolecular shifts occur in our 40s and 60s (2024)

https://med.stanford.edu/news/all-news/2024/08/massive-biomolecular-shifts-occur-in-our-40s-and-60s--stanford-m.html
158•fzliu•8h ago•92 comments

Blazing Matrix Products

https://panadestein.github.io/blog/posts/mp.html
19•Bogdanp•5h ago•1 comments

Starcloud can’t put a data centre in space at $8.2M in one Starship

https://angadh.com/space-data-centers-1
117•angadh•16h ago•175 comments

A lumberjack created more than 200 sculptures in Wisconsin's Northwoods

https://www.smithsonianmag.com/travel/when-a-lumberjacks-imagination-ran-wild-he-created-more-than-200-sculptures-in-wisconsins-northwoods-180986840/
62•noleary•10h ago•25 comments

How much slower is random access, really?

https://samestep.com/blog/random-access/
87•sestep•3d ago•44 comments

Snow - Classic Macintosh emulator

https://snowemu.com/
250•ColinWright•1d ago•83 comments

VA Tech scientists are building a better fog harp

https://arstechnica.com/science/2025/06/these-va-tech-scientists-are-building-a-better-fog-harp/
17•PaulHoule•3d ago•5 comments

Kea 3.0, our first LTS version

https://www.isc.org/blogs/kea-3-0/
94•conductor•15h ago•34 comments

Bogong moths use a stellar compass for long-distance navigation at night

https://www.nature.com/articles/s41586-025-09135-3
31•Anon84•3d ago•5 comments

Show HN: Magnitude – Open-source AI browser automation framework

https://github.com/magnitudedev/magnitude
103•anerli•17h ago•38 comments

Typr – TUI typing test with a word selection algorithm inspired by keybr

https://github.com/Sakura-sx/typr
83•Sakura-sx•4d ago•36 comments

'Peak flower power era': The story of first ever Glastonbury Festival in 1970

https://www.bbc.com/culture/article/20250620-the-story-of-the-first-ever-glastonbury-festival-in-1970
20•keepamovin•3d ago•4 comments

Collections: Nitpicking Gladiator's Iconic Opening Battle, Part I

https://acoup.blog/2025/06/06/collections-nitpicking-gladiators-iconic-opening-battle-part-i/
53•diodorus•3d ago•16 comments

A Review of Aerospike Nozzles: Current Trends in Aerospace Applications

https://www.mdpi.com/2226-4310/12/6/519
80•PaulHoule•20h ago•43 comments

Show HN: I built an AI dataset generator

https://github.com/metabase/dataset-generator
145•matthewhefferon•21h ago•29 comments
Open in hackernews

Parameterized types in C using the new tag compatibility rule

https://nullprogram.com/blog/2025/06/26/
57•ingve•6h ago

Comments

unwind•4h ago
I think this is an interesting change, even though I (as someone who has loved C for 30+ years and use it daily in a professional capacity) don't immediately see a lot of use-cases I'm sure they can be found as the author demonstrates. Cool, and a good post!
jolmg•20m ago
> don't immediately see a lot of use-cases I'm sure they can be found

Making a parameter optional when it isn't a pointer? I don't touch C often, but curiously enough I was just met with this case while making a change in i3:

  -Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode);
  +Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode, fullscreen_layer_t fullscreen_layer, bool any_layer);
I added that `fullscreen_layer` param, which is an enum, and later found that I needed to make it optional. Maybe there's a better convention for cases like this, but I couldn't think of anything better than adding that `any_layer` boolean to decide whether to use or ignore `fullscreen_layer`. If `fullscreen_layer` were a pointer, it can just be set to `NULL`, but it's not. If the definition allowed without much duplication, I'd split the function into 2, one with the fullscreen_layer param and another without. Again, not an option. I don't want to pollute the enum for the concern of a single function either. If this were Haskell, the convention here would be to wrap the `fullscreen_layer_t` in a Maybe (a parameterized type).

Extending on the example of this post to write a maybe parameterized type in C, it works:

  #include <stdio.h>

  #define MAYBE(T) struct maybe { bool is_just; T x; }
  #define JUST(T, t) ((MAYBE(T)){.is_just = true, .x = (t)})
  #define NOTHING(T) ((MAYBE(T)){.is_just = false})

  #define FROM_MAYBE(y, m) ((m).is_just ? (m).x : y)

  void print_maybe(MAYBE(unsigned) m) {
    if (m.is_just) {
      printf("%u\n", m.x);
    }
  }

  int main() {
    print_maybe(NOTHING(unsigned));
    print_maybe(JUST(unsigned, 3));
    return 0;
  }
I'm not going to use this, because it's kind of unconventional in C and it's just a single case in what I'm working on. However, if this problem were a more common occurrence, something like this might be nice to use to avoid having multiple parameters to pass around when one could be enough.
Surac•3h ago
i fear this will make slopy code compile more often OK.
ioasuncvinvaer•2h ago
Can you give an example?
poly2it•1h ago
Dear God I hope nobody is committing unreviewed LLM output in C codebases.
rwmj•3h ago
Slighty off-topic, why is he using ptrdiff_t (instead of size_t) for the cap & len types?
r1chardnl•2h ago
From one of his other blogposts. "Guidelines for computing sizes and subscripts"

  Never mix unsigned and signed operands. Prefer signed. If you need to convert an operand, see (2).
https://nullprogram.com/blog/2024/05/24/

https://www.youtube.com/watch?v=wvtFGa6XJDU

poly2it•1h ago
I still don't understand how these arguments make sense for new code. Naturally, sizes should be unsigned because they represent values which cannot be unsigned. If you do pointer/size arithmetic, the only solution to avoid overflows is to overflow-check and range-check before computation.

You cannot even check the signedness of a signed size to detect an overflow, because signed overflow is undefined!

The remaining argument from what I can tell is that comparisons between signed and unsigned sizes are bug-prone. There is however, a dedicated warning to resolve this instantly.

It makes sense that you should be able to assign a pointer to a size. If the size is signed, this cannot be done due to its smaller capacity.

Given this, I can't understand the justification. I'm currently using unsigned sizes. If you have anything contradicting, please comment :^)

sim7c00•1h ago
I dont know either.

int somearray[10];

new_ptr = somearray + signed_value;

or

element = somearray[signedvalue];

this seems almost criminal to how my brain does logic/C code.

The only thing i could think of is this:

somearray+=11; somearray[-1] // index set to somearray[10] ??

if i'd see my CPU execute that i'd want it to please stop. I'd want my compiler to shout at me like a little child, and be mean until i do better.

-Wall -Wextra -Wextra -Wpedantic <-- that should flag i think any of these weird practices.

As you stated tho, i'd be keen to learn why i am wrong!

ncruces•48m ago
> It makes sense that you should be able to assign a pointer to a size. If the size is signed, this cannot be done due to its smaller capacity.

Why?

By the definition of ptrdiff_t, ISTM the size of any object allocated by malloc cannot be out of bounds of ptrdiff_t, so I'm not sure how can you have a useful size_t that uses the sign bit?

foldr•41m ago
Stroustrup believes that signed should be preferred to unsigned even for values that can’t be less than zero: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p14...
fuhsnn•2h ago
The recent #def #enddef proposal[1] would eliminate the need for backslashes to define readable macros, making this pattern much more pleasant, finger crossed for its inclusion in C2Y!

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3531.txt

cb321•2h ago
While long-def's might be nice, you can even back in ANSI C 89 get rid of the backslash pattern (or need to cc -E and run through GNU indent/whatever) by "flipping the script" and defining whole files "parameterized" by their macro environment like https://github.com/c-blake/bst or https://github.com/glouw/ctl/

Add a namespacing macro and you have a whole generics system, unlike that in TFA.

So, it might add more value to have the C std add an `#include "file.c" name1=val1 name2=val2` preprocessor syntax where name1, name2 would be on a "stack" and be popped after processing the file. This would let you do types/functions/whatever "generic modules" with manual instantiation which kind of fits with C (manual management of memory, bounds checking, etc.) but preprocessor-assisted "macro scoping" for nested generics. Perhaps an idea to play with in your slimcc fork?

tialaramex•2h ago
It seems as though this makes it impossible to do the new-type paradigm in C23 ? If Goose and Beaver differ only in their name, C now thinks they're the same type so too bad we can tell a Beaver to fly even though we deliberately required a Goose ?
yorwba•2h ago
"Tag compatibility" means that the name has to be the same. The issue the proposal is trying to address is that "struct Goose { float weight; }" and "struct Goose { float weight; }" are different types if declared in different locations of the same translation unit, but the same if declared in different translation units. With tag compatibility, they would always be treated as being the same.

"struct Goose { float weight; }" and "struct Beaver { float weight; }" would remain incompatible, as would "struct { float weight; }" and "struct { float weight; }" (since they're declared without tags.)

tialaramex•2h ago
Ah, thanks, that makes sense.
JonChesterfield•3m ago
Not personally interested in this hack, but https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3037.pdf means struct foo {} defined multiple times with the same fields in the same TU now refers to the same thing instead of to UB and that is a good bugfix.