frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Claude Haiku 5.5

https://www.anthropic.com/claude-haiku-5-5
638•sfkgtbor•6h ago•321 comments

Margaret Hamilton has died

https://news.mit.edu/2026/margaret-hamilton-computing-pioneer-dies-1007
518•muglug•3h ago•58 comments

'Jonathan' is the oldest land animal on Earth

https://www.404media.co/oldest-living-land-animal-jonathan-the-tortoise/
32•gumby•4h ago•6 comments

GPT‑6 and Intelligent UI for everyone

https://openai.com/index/gpt-6-for-everyone/
470•joshuawright11•6h ago•245 comments

How did Rosalind Franklin miss the helix in her iconic DNA image? She didn't

https://www.science.org/content/article/how-did-rosalind-franklin-miss-helix-her-iconic-dna-image...
42•pavel_lishin•2d ago•31 comments

In Vienna and Beijing, the first (thorium) nuclear clocks begin to tick

https://www.nytimes.com/2026/10/07/science/first-nuclear-clocks-thorium-229.html
15•gumby•6h ago•1 comments

Show HN: Bigwords.page – Turn any screen into a sign. The URL is the app

https://bigwords.page/
335•SpeakingOfBrad•8h ago•106 comments

Docker Agent

https://github.com/docker/docker-agent
169•saikatsg•6h ago•80 comments

Push ifs up and fors down: The idiom, its algebra, and its limits

https://debasishg.github.io/blog/push-ifs-up-fors-down/
96•speckx•5h ago•48 comments

Shipping JPEG XL in Chrome

https://developer.chrome.com/blog/jpeg-xl-in-chrome
474•AshleysBrain•13h ago•304 comments

If somebody tries to hot-patch an already-hot-patched function

https://devblogs.microsoft.com/oldnewthing/20261005-00/?p=112755/
34•ibobev•1d ago•9 comments

A minimal kernel in Swift, running in QEMU

https://carette.xyz/posts/minimal_swift_kernel_on_qemu/
6•surprisetalk•1d ago•1 comments

Animated ASCII Art for Web Pages

https://ascii.rest/
282•turrini•9h ago•57 comments

How machines learned precision

https://glinscott.github.io/how-machines-learned-precision/
96•glinscott•1d ago•45 comments

Navier–Stokes Lost in Translation

https://arxiv.org/abs/2610.08144
240•nill0•9h ago•150 comments

A new write and space optimized storage engine for MySQL is here

https://tidesdb.com/articles/tidesdb-now-available-for-mysql/
22•alexpadula•2d ago•2 comments

A font recreated from photographs of classic Commodore 64 keycaps

https://github.com/szabadkai/c64-keyboard-font/
378•sohkamyung•15h ago•62 comments

Brownian Motion

https://gregorygundersen.com/blog/2026/04/22/brownian-motion/
23•signa11•1d ago•0 comments

Meta and Microsoft take steps to reduce employee usage of Claude AI

https://www.rswebsols.com/news/meta-and-microsoft-take-steps-to-reduce-employee-usage-of-claude-ai/
256•speckx•5h ago•252 comments

Sharing AI progress in mathematics

https://openai.com/index/sharing-ai-progress-in-mathematics/
1222•OfficialTurkey•1d ago•1399 comments

Wood Tape (2004)

http://gamesbyemail.com/WoodTape/Default.htm
151•NaOH•1d ago•17 comments

House with 15m underground tunnels for sale for 300k

https://www.readingchronicle.co.uk/news/26612080.house-15m-underground-tunnels-sale-300k/
152•librasteve•11h ago•155 comments

Nobel Prize in Chemistry 2026 to Henri B. Kagan and Kenso Soai

https://www.nobelprize.org/prizes/chemistry/2026/press-release/
289•sasvari•14h ago•54 comments

Visa, Mastercard, major banks facing new litigation over 'anticompetitive' fees

https://www.classaction.org/news/visa-mastercard-major-banks-facing-new-litigation-over-anticompe...
470•DeepLogin•9h ago•332 comments

Google Playground: Create and play custom games

https://blog.google/innovation-and-ai/technology/ai/playground-experimental-gaming-platform/
117•acossta•12h ago•194 comments

Show HN: Agent.reviews – Where AI agents read and write reviews on tools

https://agent.reviews/
37•screm•7h ago•35 comments

SynthID Detector

https://synthid.com/
87•ilreb•10h ago•77 comments

Anti-patterns in software blogging

https://refactoringenglish.com/blog/anti-patterns-software-blogging/
199•ilreb•11h ago•111 comments

AI-assisted proof of optimal packing for 11 squares

https://github.com/Queuingtheorydotcom/11SquaresFormalized
108•bluepeter•10h ago•49 comments

3D-printing platform rapidly produces complex electric machines

https://news.mit.edu/2026/3d-printing-platform-rapidly-produces-complex-electric-machines-0218
58•rbanffy•2d ago•27 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.