frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

PC Gamer recommends RSS readers in a 37mb article that just keeps downloading

https://stuartbreckenridge.net/2026-03-19-pc-gamer-recommends-rss-readers-in-a-37mb-article/
382•JumpCrisscross•8h ago•182 comments

The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

https://larstofus.com/2026/03/22/the-gold-standard-of-optimization-a-look-under-the-hood-of-rolle...
238•mariuz•8h ago•79 comments

Intuitions for Tranformer Circuits

https://www.connorjdavis.com/p/intuitions-for-transformer-circuits
23•cjamsonhn•2h ago•2 comments

The hottest new phone is Tin Can, a 'landline' for kids

https://www.businessinsider.com/tin-can-landline-kids-cellphone-cell-alternative-how-2025-9
24•tejohnso•2d ago•20 comments

The future of version control

https://bramcohen.com/p/manyana
436•c17r•11h ago•250 comments

Reports of code's death are greatly exaggerated

https://stevekrouse.com/precision
289•stevekrouse•16h ago•227 comments

Why I love NixOS

https://www.birkey.co/2026-03-22-why-i-love-nixos.html
225•birkey•9h ago•154 comments

I Reverse-Engineered the TiinyAI Pocket Lab from Marketing Photos

https://bay41.com/posts/tiiny-ai-pocket-lab-review/
42•davidklemke•3d ago•9 comments

Project Nomad – Knowledge That Never Goes Offline

https://www.projectnomad.us
377•jensgk•14h ago•114 comments

Flash-MoE: Running a 397B Parameter Model on a Laptop

https://github.com/danveloper/flash-moe
315•mft_•15h ago•108 comments

GrapheneOS will remain usable by anyone without requiring personal information

https://grapheneos.social/@GrapheneOS/116261301913660830
259•nothrowaways•5h ago•71 comments

They're Vibe-Coding Spam Now

https://tedium.co/2026/02/25/vibe-coded-email-spam/
46•raybb•5h ago•31 comments

MAUI Is Coming to Linux

https://avaloniaui.net/blog/maui-avalonia-preview-1
172•DeathArrow•11h ago•81 comments

Migrating the American Express Payment Network, Twice

https://americanexpress.io/migrating-the-payments-network-twice/
20•madflojo•2h ago•3 comments

Five Years of Running a Systems Reading Group at Microsoft

https://armaansood.com/posts/systems-reading-group/
124•Foe•10h ago•36 comments

LLMs predict my coffee

https://dynomight.net/coffee/
83•surprisetalk•4d ago•37 comments

What Young Workers Are Doing to AI-Proof Themselves

https://www.wsj.com/economy/jobs/ai-jobs-young-people-careers-14282284
86•wallflower•8h ago•107 comments

Windows native app development is a mess

https://domenic.me/windows-native-dev/
352•domenicd•17h ago•356 comments

First and Lego Education Partnership Update

https://community.firstinspires.org/first-lego-education-partnership-update
29•jchin•3d ago•13 comments

How to Attract AI Bots to Your Open Source Project

https://nesbitt.io/2026/03/21/how-to-attract-ai-bots-to-your-open-source-project.html
89•zdw•1d ago•13 comments

Building an FPGA 3dfx Voodoo with Modern RTL Tools

https://noquiche.fyi/voodoo
167•fayalalebrun•13h ago•34 comments

"Collaboration" Is Bullshit

https://www.joanwestenberg.com/collaboration-is-bullshit/
24•mitchbob•1h ago•2 comments

You are not your job

https://jry.io/writing/you-are-not-your-job/
81•jryio•11h ago•112 comments

Show HN: Codala, a social network built on scanning barcodes

https://play.google.com/store/apps/details?id=com.hsynkrkye.codala&hl=en
35•hsynkrkye•4d ago•17 comments

More common mistakes to avoid when creating system architecture diagrams

https://www.ilograph.com/blog/posts/more-common-diagram-mistakes/
144•billyp-rva•15h ago•52 comments

Ordered Dithering with Arbitrary or Irregular Colour Palettes (2023)

https://matejlou.blog/2023/12/06/ordered-dithering-for-arbitrary-or-irregular-palettes/
10•surprisetalk•5d ago•0 comments

Teaching Claude to QA a mobile app

https://christophermeiklejohn.com/ai/zabriskie/development/android/ios/2026/03/22/teaching-claude...
72•azhenley•8h ago•7 comments

Theodosian Land Walls of Constantinople (2025)

https://turkisharchaeonews.net/object/theodosian-land-walls-constantinople
29•bcraven•3d ago•7 comments

25 Years of Eggs

https://www.john-rush.com/posts/eggs-25-years-20260219.html
256•avyfain•4d ago•73 comments

The IBM scientist who rewrote the rules of information just won a Turing Award

https://www.ibm.com/think/news/ibm-scientist-charles-bennett-turing-award
106•rbanffy•15h ago•8 comments
Open in hackernews

Detecting if an expression is constant in C

https://nrk.neocities.org/articles/c-constexpr-macro#detecting-if-an-expression-is-constant-in-c
49•signa11•10mo ago

Comments

wahern•10mo ago
> This works. But both gcc and clang warn about the enum being anonymous... even though that's exactly what I wanted to do. And this cannot be silenced with #pragma since it's a macro, so the warning occurs at the location where the macro is invoked.

You can use _Pragma instead of #pragma. E.g.

  #define C(x) ( \
    _Pragma("clang diagnostic push") \
    _Pragma("clang diagnostic ignored \"-Wvisibility\"") \
    (x) + 0*sizeof(void (*)(enum { tmp = (int)(x) })) \
    _Pragma("clang diagnostic pop") \
  )
EDIT: Alas, GCC is a little pickier about where _Pragma is allowed so you may need to use a statement expression. Also, it seems GCC 14 doesn't have a -W switch that will disable the anonymous enum warning.
pjc50•10mo ago
It's remarkable that people will say that doing this kind of thing is better than learning a language which actually lets you enforce this with the type system.

(or even just insist that users use the version of the language which supports "constexpr"!)

oguz-ismail•10mo ago
What language is that? Is it available everywhere (everywhere) C is?
mitthrowaway2•10mo ago
Indeed, usually if I'm using C these days it's because I only have access to a c compiler for my target platform, or because I'm modifying an existing C codebase.
uecker•10mo ago
I do not think anybody said this. The point is that these macros work for early versions of C. If you need to support early versions of C, learning another language is not a solution. If you don't have to, you can use C23's constexpr.
trealira•10mo ago
C used to seem like a beautiful and simple language to me, but as I used it and learned more about it, it seemed more complex under the surface, and kind of janky as well. It's just utilitarian.
wat10000•10mo ago
Learning such a language doesn’t mean I can use it.
o11c•10mo ago
The problem is that no such language exists.

There are many languages that provide one particular feature that C doesn't provide, but they do this at the cost of excluding numerous other features that C widely relies on.

kjs3•10mo ago
"I have no idea what problem you're trying to solve, what the constraints are, what the use cases might be, what tools are available on the platform, what the job or regulations require, what the skillsets of the people involved are, what the timeline is...but I'm absolutely, unshakably certain that I have a magic bullet that will make all your problems go away."

FTFY.

sleirsgoevy•10mo ago
The Linux kernel has even a way to determine whether the expression is compile-time, WITHOUT aborting compilation in either case.

The trick is this (copied vebratim from Linux):

#define __is_constexpr(x) (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))

Explanation: if x is a constant expression, then multiplying it by zero yields a constant 0, and casting a constant 0 to void* makes a null pointer constant. And the ternary expression, if one of its sides is a null pointer constant, collapses to the type of the other side (thus the type of the returned pointer will be int*, and the sizeof will match). And if x was not constant, then the lefthand side would not be considered a null pointer constant by type inference, the type of the ternary expression will be void*, and the sizeof check will not match.

With a few more clever tricks, it's even possible to implement a compile-time "type ternary expression", like this: TYPE_IF(2 * 2 == 4, int, long). This is left as an exercise for the reader.

amelius•10mo ago
This reminds me of the days when Boost was a thing. It was full of tricks like this.
usrnm•10mo ago
It still is a thing, though.
cperciva•10mo ago
With a few more clever tricks...

I did this with my PARSENUM macro (https://github.com/Tarsnap/libcperciva/blob/master/util/pars...) to parse strings into floating-point, unsigned integer, or signed integer types (and check bounds) using a single interface.

bobbyi•10mo ago
I thought this would work:

#define C(x) (sizeof(char[x]), x)

sizeof is a compile-time operation so x need to be known at compile time.

It didn't work as expected. It turns out there is an exception and the standard says that sizeof is actually calculated at runtime specifically for variable length arrays:

> The sizeof operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. The size is determined from the type of the operand. The result is an integer. If the type of the operand is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant.