frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

The 'Paperwork Flood': How I Drowned a Bureaucrat Before Dinner

https://sightlessscribbles.com/posts/the-paperwork-flood/
305•robin_reala•2h ago•202 comments

Anatomy of the .claude/ Folder

https://blog.dailydoseofds.com/p/anatomy-of-the-claude-folder
39•freedomben•1h ago•20 comments

Installing a Let's Encrypt TLS Certificate on a Brother Printer with Certbot

https://owltec.ca/Other/Installing+a+Let%27s+Encrypt+TLS+certificate+on+a+Brother+printer+automat...
37•8organicbits•1h ago•1 comments

Iran-linked hackers claim breach of FBI director's personal email

https://www.reuters.com/world/us/iran-linked-hackers-claim-breach-of-fbi-directors-personal-email...
81•m-hodges•58m ago•38 comments

A Faster Alternative to Jq

https://micahkepe.com/blog/jsongrep/
267•pistolario•8h ago•162 comments

This picture broke my brain [3B1B video]

https://www.youtube.com/watch?v=ldxFjLJ3rVY
84•jgwil2•4d ago•33 comments

Hold on to Your Hardware

https://xn--gckvb8fzb.com/hold-on-to-your-hardware/
372•LucidLynx•5h ago•316 comments

Schedule tasks on the web

https://code.claude.com/docs/en/web-scheduled-tasks
232•iBelieve•10h ago•191 comments

Apple discontinues the Mac Pro

https://9to5mac.com/2026/03/26/apple-discontinues-the-mac-pro/
537•bentocorp•18h ago•469 comments

Gzip decompression in 250 lines of Rust

https://iev.ee/blog/gzip-decompression-in-250-lines-of-rust/
31•vismit2000•3d ago•10 comments

Why so many control rooms were seafoam green (2025)

https://bethmathews.substack.com/p/why-so-many-control-rooms-were-seafoam
933•Amorymeltzer•1d ago•191 comments

The European AllSky7 fireball network

https://www.allsky7.net/#archive
95•marklit•8h ago•7 comments

Local Bernstein theory, and lower bounds for Lebesgue constants

https://terrytao.wordpress.com/2026/03/23/local-bernstein-theory-and-lower-bounds-for-lebesgue-co...
34•jjgreen•3d ago•7 comments

Anthropic's Claude loses its >99% uptime in Q1 2026

https://bsky.app/profile/teropa.bsky.social/post/3mi2dbt27m226
30•timpera•56m ago•26 comments

Rising Air-Conditioning Use Intensifies Global Warming

https://www.nature.com/articles/s41467-026-69393-1
12•PaulHoule•43m ago•9 comments

Show HN: I put an AI agent on a $7/month VPS with IRC as its transport layer

https://georgelarson.me/writing/2026-03-23-nullclaw-doorman/
294•j0rg3•16h ago•84 comments

EMachines never obsolete PCs: More than a meme

https://dfarq.homeip.net/emachines-never-obsolete-pcs-more-than-a-meme/
6•zdw•3d ago•1 comments

$500 GPU outperforms Claude Sonnet on coding benchmarks

https://github.com/itigges22/ATLAS
407•yogthos•22h ago•224 comments

Rank the 50 best Apple products

https://www.theverge.com/cs/tech/900477/apple-50-anniversary-rank-products
14•dqieu•52m ago•6 comments

Hong Kong Police Can Now Demand Phone Passwords Under New Security Rules

https://www.gadgetreview.com/hong-kong-police-can-now-demand-phone-passwords-under-new-security-r...
77•vidyesh•1h ago•72 comments

People inside Microsoft are fighting to drop mandatory Microsoft Account

https://www.windowscentral.com/microsoft/windows-11/people-inside-microsoft-are-fighting-to-drop-...
28•breve•1h ago•5 comments

Everything old is new again: memory optimization

https://nibblestew.blogspot.com/2026/03/everything-old-is-new-again-memory.html
117•ibobev•3d ago•80 comments

QRV Operating System: QNX on RISC-V

https://r-tty.blogspot.com/2026/03/qrv-operating-system-first-publication.html
40•chrsw•4d ago•7 comments

We rewrote JSONata with AI in a day, saved $500k/year

https://www.reco.ai/blog/we-rewrote-jsonata-with-ai
230•cjlm•17h ago•209 comments

DOOM Over DNS

https://github.com/resumex/doom-over-dns
329•Venn1•4d ago•87 comments

Running Tesla Model 3's computer on my desk using parts from crashed cars

https://bugs.xdavidhu.me/tesla/2026/03/23/running-tesla-model-3s-computer-on-my-desk-using-parts-...
920•driesdep•1d ago•320 comments

My minute-by-minute response to the LiteLLM malware attack

https://futuresearch.ai/blog/litellm-attack-transcript/
408•Fibonar•23h ago•152 comments

Whistler: Live eBPF Programming from the Common Lisp REPL

https://atgreen.github.io/repl-yell/posts/whistler/
118•varjag•3d ago•14 comments

HyperAgents: Self-referential self-improving agents

https://github.com/facebookresearch/hyperagents
219•andyg_blog•2d ago•76 comments

Generators in Lone Lisp

https://www.matheusmoreira.com/articles/generators-in-lone-lisp
55•matheusmoreira•4d ago•10 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.