frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

AV1: A Modern, Open Codec

https://netflixtechblog.com/av1-now-powering-30-of-netflix-streaming-02f592242d80
154•CharlesW•2h ago•68 comments

BMW PHEV: When EU engineering becomes a synonym for "unrepairable" (EV Clinic)

https://evclinic.eu/2025/12/04/2021-phev-bmw-ibmucp-21f37e-post-crash-recovery-when-eu-engineerin...
57•mikelabatt•1h ago•11 comments

Trick users and bypass warnings – Modern SVG Clickjacking attacks

https://lyra.horse/blog/2025/12/svg-clickjacking/
41•spartanatreyu•2h ago•5 comments

CUDA-l2: Surpassing cuBLAS performance for matrix multiplication through RL

https://github.com/deepreinforce-ai/CUDA-L2
82•dzign•5h ago•11 comments

The Ofcom Files, Part 4: Ofcom Rides Again

https://prestonbyrne.com/2025/12/04/the-ofcom-files-part-4-ofcom-rides-again/
31•parliament32•1h ago•3 comments

State of AI: An Empirical 100T Token Study with OpenRouter

https://openrouter.ai/state-of-ai
117•anjneymidha•4h ago•46 comments

Brussels writes so many laws

https://www.siliconcontinent.com/p/how-brussels-writes-so-many-laws
12•amadeuspagel•54m ago•7 comments

Multivox: Volumetric Display

https://github.com/AncientJames/multivox
233•jk_tech•9h ago•30 comments

NeurIPS best paper awards 2025

https://blog.neurips.cc/2025/11/26/announcing-the-neurips-2025-best-paper-awards/
10•ivansavz•1h ago•1 comments

It’s time to free JavaScript (2024)

https://javascript.tm/letter
663•pavelai•17h ago•336 comments

Transparent leadership beats servant leadership

https://entropicthoughts.com/transparent-leadership-beats-servant-leadership
375•ibobev•12h ago•180 comments

StardustOS: Library operating system for building light-weight Unikernels

https://github.com/StardustOS
26•transpute•3h ago•1 comments

Thoughts on Go vs. Rust vs. Zig

https://sinclairtarget.com/blog/2025/08/thoughts-on-go-vs.-rust-vs.-zig/
231•yurivish•4h ago•237 comments

Why are 38 percent of Stanford students saying they're disabled?

https://reason.com/2025/12/04/why-are-38-percent-of-stanford-students-saying-theyre-disabled/
491•delichon•8h ago•730 comments

How elites could shape mass preferences as AI reduces persuasion costs

https://arxiv.org/abs/2512.04047
497•50kIters•17h ago•486 comments

Django 6

https://docs.djangoproject.com/en/6.0/releases/6.0/
235•wilhelmklopp•5h ago•114 comments

We gave 5 LLMs $100K to trade stocks for 8 months

https://www.aitradearena.com/research/we-ran-llms-for-8-months
162•cheeseblubber•3h ago•146 comments

Help, My Java Object Vanished (and the GC Is Not at Fault)

https://arraying.de/posts/markword/
23•birdculture•5d ago•2 comments

Show HN: Onlyrecipe 2.0 – I added all features HN requested – 4 years later

https://onlyrecipeapp.com/?url=https://www.allrecipes.com/turkish-pasta-recipe-8754903
133•AwkwardPanda•11h ago•108 comments

PyTogether: Collaborative lightweight real-time Python IDE for teachers/learners

https://github.com/SJRiz/pytogether
63•indigodaddy•8h ago•18 comments

Oedipus is about the act of figuring out what Oedipus is about

https://interconnected.org/home/2025/11/07/oedipus
4•surprisetalk•5d ago•0 comments

I ignore the spotlight as a staff engineer

https://lalitm.com/software-engineering-outside-the-spotlight/
420•todsacerdoti•14h ago•200 comments

Fighting the age-gated internet

https://www.wired.com/story/age-verification-is-sweeping-the-us-activists-are-fighting-back/
173•geox•12h ago•165 comments

Converge (YC S23) is hiring a martech expert in NYC

https://www.runconverge.com/careers/technical-customer-success-manager
1•janhenr•9h ago

A Cozy Mk IV light aircraft crashed after 3D-printed part was weakened by heat

https://www.bbc.com/news/articles/c1w932vqye0o
222•toss1•5h ago•177 comments

CSS now has an if() conditional function

https://caniuse.com/?search=if
36•aanthonymax•5d ago•9 comments

What is better: a lookup table or an enum type?

https://www.cybertec-postgresql.com/en/lookup-table-or-enum-type/
9•todsacerdoti•2h ago•4 comments

Autism should not be treated as a single condition

https://www.economist.com/science-and-technology/2025/12/03/why-autism-should-not-be-treated-as-a...
209•bookofjoe•10h ago•262 comments

Ultrasonic device dramatically speeds harvesting of water from the air

https://news.mit.edu/2025/ultrasonic-device-dramatically-speeds-harvesting-water-air-1118
10•bookofjoe•46m ago•1 comments

PGlite – Embeddable Postgres

https://pglite.dev/
511•dsego•15h ago•103 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•6mo ago

Comments

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