News for hackers. Stuff that matters.
Re:Porting Go's io package to C by mitul005 on Thursday March 26, 2026 @03:53AM (#47527729)
Go’s io package works so well because interfaces are implicit and lightweight.

In C, you can mimic the shape with function pointers, but you lose a lot of the ergonomics and safety. Curious how far you can push composability before it becomes too cumbersome to use in practice.

Re:Porting Go's io package to C by jjgreen on Thursday March 26, 2026 @05:38AM (#47528386)
A nit on the use of *: in lots of places there are "int* foo" and so on, but in C it's traditional to have "int *foo" since "int* foo, bar" looks like foo & bar are pointers, but they are not, bar is an int, while "int *foo, bar" suggests the interpretation that the compiler will make.
Re:Porting Go's io package to C by mitul005 on Thursday March 26, 2026 @09:23AM (#47530169)
Good catch—C’s declarator syntax can definitely be misleading there, especially with multiple variables in one line.