frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Map of Metal

https://mapofmetal.com/
63•robin_reala•1h ago•18 comments

Everything in C is undefined behavior

https://blog.habets.se/2026/05/Everything-in-C-is-undefined-behavior.html
293•lycopodiopsida•6h ago•395 comments

Learnings from 100K lines of Rust with AI (2025)

https://zfhuang99.github.io/rust/claude%20code/codex/contracts/spec-driven%20development/2025/12/...
79•pramodbiligiri•2h ago•70 comments

Gemini 3.5 Flash

https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-3-5/
844•spectraldrift•18h ago•584 comments

FiveThirtyEight articles on the Internet Archive

https://fivethirtyeightindex.com/
249•ChocMontePy•11h ago•63 comments

Qwen3.7-Max: The Agent Frontier

https://qwen.ai/blog?id=qwen3.7
40•kevinsimper•2h ago•11 comments

I’ve built a virtual museum with nearly every operating system you can think of

https://virtualosmuseum.org/
841•andreww591•20h ago•178 comments

Japan is gripped by mass allergies. A 1950s project is to blame

https://www.bbc.com/future/article/20260515-the-1950s-blunder-which-causes-mass-hay-fever-in-japan
172•ranit•10h ago•71 comments

College students drown out AI-praising commencement speeches with boos

https://www.tomshardware.com/tech-industry/artificial-intelligence/college-students-drown-out-ai-...
25•iancmceachern•45m ago•9 comments

Infomaniak transitions to a foundation model to protect user data privacy

https://news.infomaniak.com/en/infomaniak-foundation-sovereign-cloud/
107•darktoto•6h ago•28 comments

Google changes its search box

https://blog.google/products-and-platforms/products/search/search-io-2026/
594•berkeleyjunk•18h ago•800 comments

Show HN: Forge – Guardrails take an 8B model from 53% to 99% on agentic tasks

https://github.com/antoinezambelli/forge
542•zambelli•1d ago•186 comments

Nobody understands the point of hybrid cars [video]

https://www.youtube.com/watch?v=KnUFH5GX_fI
15•CHB0403085482•2d ago•4 comments

Remove-AI-Watermarks – CLI and library for removing AI watermarks from images

https://github.com/wiltodelta/remove-ai-watermarks
319•janalsncm•14h ago•188 comments

Apple unveils new accessibility features

https://www.apple.com/newsroom/2026/05/apple-unveils-new-accessibility-features-and-updates-with-...
689•interpol_p•1d ago•362 comments

OpenAI Adopts Google's SynthID Watermark for AI Images with Verification Tool

https://openai.com/index/advancing-content-provenance/
301•smooke•17h ago•163 comments

Mistral AI acquires Emmi AI

https://www.emmi.ai/news/mistral-ai-acquires-emmi-ai
283•doener•17h ago•83 comments

Gemini CLI will stop working from June 18, 2026

https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/
272•primaprashant•18h ago•137 comments

No way to parse integers in C (2022)

https://blog.habets.se/2022/10/No-way-to-parse-integers-in-C.html
9•konmok•2h ago•0 comments

CopyFail: From Pod to Host

https://xint.io/blog/copy-fail-pod-to-host
32•tptacek•19h ago•4 comments

Simulated Evolution on the PICO-8

https://bumbershootsoft.wordpress.com/2026/05/16/simulated-evolution-on-the-pico-8/
22•ibobev•1d ago•1 comments

The Invention of Buses

https://worksinprogress.co/issue/the-invention-of-buses/
16•surprisetalk•1d ago•2 comments

RISC-V and Floating-Point

https://fprox.substack.com/p/risc-v-and-floating-point
33•hasheddan•1d ago•26 comments

Incident Report: Railway Blocked by Google Cloud (Resolved)

https://blog.railway.com/p/incident-report-may-19-2026-gcp-account-outage
502•aarondf•12h ago•317 comments

In 1979 engineer Hugh Padgham discovered "gated reverb" – by accident

https://producelikeapro.com/blog/how-one-recording-mistake-created-a-musical-phenomenon-in-the-80s/
63•bookofjoe•2d ago•21 comments

GitHub is investigating unauthorized access to their internal repositories

https://twitter.com/github/status/2056884788179726685
512•splenditer•12h ago•277 comments

The Mercury logic programming system

https://github.com/Mercury-Language/mercury
75•Antibabelic•2d ago•15 comments

Minnesota becomes first state to ban prediction markets

https://www.npr.org/2026/05/19/nx-s1-5821265/minnesota-ban-prediction-markets
701•ortusdux•17h ago•215 comments

I’ve joined Anthropic

https://twitter.com/karpathy/status/2056753169888334312
1365•dmarcos•21h ago•571 comments

Growing Neural Cellular Automata

https://distill.pub/2020/growing-ca/
121•pulkitsh1234•2d ago•12 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.