frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

REA Reverse – Engineer Anything

https://rea.tools/
155•modinfo•2h ago•37 comments

Cloudflare acquires Deno

https://deno.com/blog/cloudflare
1106•ilreb•14h ago•570 comments

Triple-A Minesweeper

https://minesweeper.mikelacher.com/
733•robin_reala•11h ago•142 comments

Our $445M Series D

https://oxide.computer/blog/our-445m-series-d
614•ahlCVA•14h ago•275 comments

Show HN: Carrier-Explode: iPhone, Pixel and Galaxy carrier settings decoded

https://carrierexplode.com/
232•simplyalec•9h ago•31 comments

Can you use autoregressive diffusion to generate market data?

https://blog.janestreet.com/can-you-use-autoregressive-diffusion-to-generate-market-data/
28•jsomers•12h ago•10 comments

Typesafe AI raises $870M at $7.5B

https://typesafe.ai/blog/series-ai
297•tosh•10h ago•225 comments

Compiling Rust to readable C with Eurydice

https://lwn.net/Articles/1055211/
34•peter_d_sherman•4h ago•2 comments

Pointing AI at archives found a forgotten meteorite, lost rhinos, and more

https://jessewaites.com/blog/post/i-pointed-ai-at-400-years-of-archives/
117•piratebroadcast•15h ago•56 comments

YouTuber Says Cops Visited Him After He Built a Flock-Style Camera to Track Cops

https://gizmodo.com/youtuber-says-cops-paid-him-a-visit-after-he-built-flock-style-camera-to-trac...
469•gumby•6h ago•260 comments

Eye of Sauron: Long-Range Hidden Spy Camera Detection

https://www.usenix.org/conference/usenixsecurity24/presentation/zhang-qibo
14•ortusdux•2d ago•2 comments

11 of 23 Core Open Source Projects Run on 1 or 2 People

https://linuxstans.com/11-of-23-core-open-source-projects-run-on-1-or-2-people/
80•dxs•3h ago•34 comments

Show HN: Proton Drive for Linux

https://oss.lsantos.dev/proton-drive-linux-fs/
43•khaosdoctor•1d ago•15 comments

Atari Falcon

https://atarimuseum.nl/atari-falcon/
24•debo_•4h ago•4 comments

Has the Autonomous Trucking Revolution Arrived?

https://phenomenalworld.org/analysis/has-the-autonomous-trucking-revolution-arrived/
11•demonsthenes•3h ago•11 comments

Rewriting Prime Agent in Rust

https://www.primeintellect.ai/blog/prime-agent-rust
30•piotrgrabowski•4h ago•10 comments

The role of cat eye narrowing movements in cat–human communication (2020)

https://www.nature.com/articles/s41598-020-73426-0
48•bushwart•3d ago•22 comments

Sorry, I'm in a meeting

https://iminafleeting.com/
799•splintersio•18h ago•245 comments

'Wallace and Gromit,' 90% Alone

https://animationobsessive.substack.com/p/wallace-and-gromit-90-alone
169•vinhnx•13h ago•22 comments

Show HN: The rarest tech books and docs you've probably never read

https://readrare.com/
84•miletus•9h ago•25 comments

100+ reactions to 100+ solutions

https://proofsandprompts.com/2026/10/08/100-reactions-to-100-solutions/
44•jacobedawson•15h ago•41 comments

What mathematicians should know about the Lean Theorem Prover: reliability & AI

https://terrytao.wordpress.com/2026/10/09/what-mathematicians-should-know-about-the-lean-theorem-...
47•matt_d•9h ago•5 comments

Scam American companies are using to manipulate ingredient lists

https://twitter.com/WallStreetApes/status/2108594998656807078
68•bilsbie•9h ago•77 comments

Anthropic AI model submits false tip on unsolved Philly murder

https://www.nbcphiladelphia.com/news/local/anthropic-ai-model-submits-false-tip-on-unsolved-phill...
89•Zambyte•5h ago•77 comments

Smart contracts: Ship the parachute in v1

https://medium.com/@giladha/ship-the-parachute-in-v1-why-upgradeability-and-disaster-recovery-are...
7•giladha•1d ago•2 comments

The logarithms of rational numbers have irrationality exponent 2 [pdf]

https://jdb19937.github.io/log-irrationality-measure/logmeasure.pdf
12•jdb1729•4h ago•3 comments

M7.6 Earthquake in Panama

https://earthquake.usgs.gov/earthquakes/eventpage/us6000u18k/executive
141•gslin•9h ago•36 comments

Microsoft-Decision-1, our model for fast decision-making

https://commandline.microsoft.com/microsoft-decision-1-model-foundry/
158•lisajaloza•8h ago•56 comments

Programming Isn't Special

https://blog.glyph.im/2026/10/programming-isnt-special.html
180•ingve•19h ago•201 comments

Show HN: Let your AI agents paint big arrows, boxes and text on your screen

https://github.com/franzenzenhofer/big-arrow-on-the-screen
385•franze•16h ago•169 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•1y ago

Comments

wahern•1y 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•1y 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•1y ago
What language is that? Is it available everywhere (everywhere) C is?
mitthrowaway2•1y 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•1y 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•1y 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•1y ago
Learning such a language doesn’t mean I can use it.
o11c•1y 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•1y 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•1y 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•1y ago
This reminds me of the days when Boost was a thing. It was full of tricks like this.
usrnm•1y ago
It still is a thing, though.
cperciva•1y 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•1y 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.