frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

"They had no concept of a duty of care to their users."

https://unsung.aresluna.org/they-had-no-concept-of-a-duty-of-care-to-their-users/
153•jandeboevrie•1h ago•103 comments

In an $80 Motel Room, a Discovery to Shed Light on the Origins of Life

https://www.nytimes.com/2026/09/26/science/motel-science-discovery.html
51•danso•1h ago•19 comments

The Normalization of Inexplicable Failures

https://www.ihatethefuture.com/2026/09/the-normalization-of-inexplicable.html
21•pxx•42m ago•1 comments

Replacing the old battery on rechargeable bike lights

https://jvns.ca/blog/2026/09/27/replacing-the-old-battery-on-rechargeable-bike-lights/
54•surprisetalk•2h ago•18 comments

Writing Efficient C++ Code

https://asawicki.info/articles/writing_efficient_cpp_code.php
28•ibobev•1d ago•4 comments

Font where each token is equal-width

https://twitter.com/amplifiedamp/status/2103535129503383700
18•ampdot•23h ago•5 comments

Show HN: TinyAIArena watch AI agents battle it out

https://tinyaiarena.com/
4•hp6•17m ago•1 comments

Ten Lines of Code That Changed My World

https://pixelambacht.nl/2026/ten-lines-of-code/
21•dimonomid•2h ago•3 comments

Flip Fluid on Flip Dots

https://mitxela.com/projects/flipflip
260•blutack•1d ago•17 comments

Fakecloud: Local AWS cloud emulator for integration tests

https://fakecloud.dev/
41•theanonymousone•1d ago•20 comments

Show HN: A CC0 museum of retro 3D tricks you can paste into a page

https://3d-retro.com/
28•SouthWestAtlas•3d ago•7 comments

Does Georgism work? Five years later

https://www.astralcodexten.com/p/does-georgism-work-five-years-later
456•silveraxe93•2d ago•350 comments

Unsealed Briefs in Authors’ Case v. Microsoft/OpenAI

https://authorsguild.org/news/ag-v-openai-top-execs-knew-mass-book-piracy-was-illegal/
540•papergirl•9h ago•477 comments

Go Concurrency Distilled

https://antonz.org/go-concurrency-distilled/
308•chmaynard•1d ago•134 comments

Finally, A True Blue Rose Exists

https://www.sciencenews.org/article/true-blue-rose-pigment-copigment
68•bookofjoe•1d ago•26 comments

PipePipe: NewPipe hard fork implementing SponsorBlock

https://github.com/InfinityLoop1308/PipePipe
466•Qision•2d ago•249 comments

The internet discovers TLA+. Now what?

https://reasonable.io/blog/tla-tutorial/
78•matt_d•10h ago•40 comments

Rusty thoughts on "Parse, don't validate"

https://eli.thegreenplace.net/2026/rusty-thoughts-on-parse-dont-validate/
35•ingve•7h ago•11 comments

postmarketOS Rebrand: Nura

https://nura.eco/blog/2026/09/27/nura-rename/
14•HotGarbage•37m ago•0 comments

10 Tells of a Slop UI

https://hereticpleb.vercel.app/blog/10-tells-of-slop
160•theanonymousone•1h ago•127 comments

DeepSeek Elastic Compute (DSec)

https://arxiv.org/abs/2609.22978
299•shenli3514•21h ago•94 comments

Show HN: Reladraw – A diagram language where you decide where to place things

https://github.com/reladraw/reladraw
360•jpwalsh234•22h ago•95 comments

ASML says it sold 'absolutely nothing' in Europe in 2026

https://www.tomshardware.com/tech-industry/semiconductors/asml-says-its-sells-absolutely-nothing-...
367•MC995•2d ago•789 comments

"As a Language Model": Chat Template Switches LLM Self-Referential Voice

https://arxiv.org/abs/2609.25021
83•yu3zhou4•5h ago•90 comments

Biology might not be quantum, but its math is quantumlike

https://www.quantamagazine.org/biology-might-not-be-quantum-but-its-math-is-quantumlike-20260923/
104•pseudolus•2d ago•41 comments

A searchable library of forgotten public-domain film clips from 1915 onward

https://www.movingimagearchive.com/
197•momentmaker•2d ago•26 comments

An agent used DNS to reach an external chatbot

https://alignment.openai.com/misalignment-reports/an-agent-used-dns-to-reach-an-external-chatbot/
141•apsec112•1d ago•141 comments

Fifteen years later, the Apple Cards origin story

https://lexontech.org/fifteen-years-later-the-apple-cards-origin-story
421•ksec•1d ago•110 comments

How I changed teaching after AI managed to do all my homework assignments

https://thelastsoftwareengineer.substack.com/p/how-i-changed-teaching-after-ai-managed
264•azhenley•2d ago•252 comments

Exploding variance of means of exponentials: least-squares to the rescue

https://francisbach.com/spectral_log_density_estimation/
55•matt_d•1d ago•0 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.