frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

93% of paint splatters are valid Perl programs (2019)

https://www.mcmillen.dev/sigbovik/
316•zenincognito•7h ago•44 comments

Tim Peters has died

https://discuss.python.org/t/in-memoriam-tim-peters-1952-2026/110028
1034•ayhanfuat•23h ago•114 comments

AWS emulator

https://github.com/aws/aws-emulator
772•super_linear•11h ago•227 comments

Critical RCE Vulnerability in Apache HTTP Server

https://www.wiz.io/blog/cve-2026-119618-rce-apache-http-server-vulnerability
88•soheilpro•3h ago•36 comments

Nvidia is preparing to oust Jensen Huang

https://www.wsj.com/business/nvidia-is-preparing-to-oust-nvidia-ceo-jensen-huang-30f421ad
802•jbredeche•7h ago•1140 comments

Gemini Decisions API

https://blog.google/innovation-and-ai/technology/developers-tools/gemini-decisions-api/
354•iamdelirium•11h ago•110 comments

A false smoke alarm almost drowned Jane Street's only NYC datacenter

https://michael.bacarella.com/2026/11/10/false-smoke-alarm-jane-street-datacenter/
455•mbac32768•13h ago•227 comments

United Airlines bans AI agents from booking flights on behalf of travelers

https://www.cbsnews.com/news/united-airlines-bans-ai-agents-booking-flights/
499•herpderperator•8h ago•478 comments

Lock Your GitHub Actions

https://hugovk.dev/blog/2026/lock-github-actions/
195•gslin•7h ago•35 comments

Did Life Begin in an RNA World?

https://www.quantamagazine.org/did-life-begin-in-an-rna-world-20261109/
43•acossta•2d ago•15 comments

Darling Development Update – Q4 2026

https://blog.darlinghq.org/2026/11/08/development-update-q4-2026/
8•tech234a•1h ago•2 comments

Emacs in the Age of Magic

https://commandlinesystems.com/magic.txt
191•ggcr•9h ago•67 comments

Lean Grimoire

https://terrytao.wordpress.com/2026/11/11/lean-grimoire/
27•smilelamp•3h ago•4 comments

The Utah Teapot

https://graphics.cs.utah.edu/teapot/
117•cobbal•10h ago•29 comments

Stingray Fish Laser

https://www.stingray.no/en/technology/
23•tptacek•2d ago•14 comments

A general purpose Apple Silicon layer for x86-64 PCs

https://github.com/tylertms/Stela
85•iceboundrock•7h ago•34 comments

My AI agents found an unmapped Maya site?

https://pietromiotti.com/latest/maya-site
959•eyvindn•18h ago•351 comments

How to make a CNC plasma cutter with high-frequency start

https://incoherency.co.uk/blog/stories/cnc-plasma-cutter.html
29•edward•3d ago•7 comments

Hyper-Realistic Sand with WebGL2

https://av.github.io/safe-sand/
344•everlier•16h ago•67 comments

Faster Retrieval for Better, More Efficient RAG

https://machinelearning.apple.com/research/faster-retrieval
187•zerop•13h ago•35 comments

Show HN: Yogurt – Free, private, open-source alternative to Granola

https://github.com/FrigadeHQ/yogurt
213•brownrout•14h ago•91 comments

Show HN: I recreated Papers Please but you're deciding which YC startups to fund

https://termsheetplease.com/
204•bolau•10h ago•82 comments

Can a Linear Program Do Weight-Space Programming?

https://nathan.rs/posts/weight-space-lp/
269•emschwartz•17h ago•38 comments

A Brief History of Sierra Online (2017)

https://retrofreakreviews.com/2017/01/30/sierra-retrospective/
46•freshtake•2d ago•16 comments

Huawei releases MACaQ, its internal quantizer for local inference

https://github.com/huawei-csl/MACaQ
81•thefox96•9h ago•23 comments

Jensen Huang said to have had relationship with executive who reports to him

https://www.nytimes.com/2026/11/11/technology/jensen-huang-nvidia-affair.html
329•louiereederson•8h ago•387 comments

The Learjet Repo Man (2009)

https://www.salon.com/2009/06/06/lear_jet_repo_man/
36•HR01•3d ago•12 comments

Atuin Threads: All your agent sessions on every machine

https://blog.atuin.sh/threads-agent-sessions/
208•linsomniac•15h ago•78 comments

Using voltage glitching to unleash the A100 in my mining card

https://blog.kate.land/posts/using-voltage-glitching-to-unlock-the-a100/
287•lae•19h ago•115 comments

Slavdom Unearthed: Marian Wawrzeniecki's Neopagan Paintings (1891–1923)

https://publicdomainreview.org/collection/marian-wawrzeniecki/
6•lermontov•3d 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.