frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Read this before you buy that TV streaming stick

https://krebsonsecurity.com/2026/07/read-this-before-you-buy-that-tv-streaming-stick/
328•speckx•4h ago•173 comments

Gemini Robotics 2 brings whole body intelligence to robots

https://deepmind.google/blog/gemini-robotics-2-brings-whole-body-intelligence-to-robots/
389•ai2027•5h ago•342 comments

I obtained Claude Opus 5 system prompt

https://claude.ai/share/98073770-0ad9-431f-a1e7-e0243db18758
15•juleiie•16m ago•6 comments

Stacked PRs are now live on GitHub

https://github.blog/changelog/2026-07-30-stacked-pull-requests-are-now-in-public-preview/
271•tomzorz•4h ago•102 comments

2x, not 10x: coding with LLMs in 2026

https://obryant.dev/p/2x-not-10x/
119•tnisonoff•5d ago•80 comments

So you want to use plants to reduce CO₂

https://dynomight.net/plants/
86•surprisetalk•2h ago•51 comments

Making Postgres queues scale

https://www.dbos.dev/blog/making-postgres-queues-scale
77•KraftyOne•2h ago•10 comments

UEFA and its national associations will not participate in FIFA competitions

https://www.uefa.com/news-media/news/02a7-213a92896eb0-54dfbf454e3b-1000--statement-on-behalf-of-...
441•dickfickling•2h ago•274 comments

CodePen 2.0

https://chriscoyier.net/2026/07/30/codepen-2-0/
82•robin_reala•3h ago•17 comments

Advancing the price-performance frontier with GPT‑5.6

https://openai.com/index/advancing-the-price-performance-frontier-with-gpt-5-6/
400•tedsanders•3h ago•261 comments

Agent Skill to Force Docs in ASD-STE100 Simplified Technical English

https://github.com/AminBlg/SimpleEnglish
17•navs•1h ago•5 comments

Physicists Solve a Muon Mystery. Now, Old Results Don't Add Up

https://www.quantamagazine.org/physicists-solve-a-muon-mystery-now-old-results-dont-add-up-20260729/
137•ibobev•5h ago•70 comments

Memo-1: A 6502 computer built from scratch, using a Minitel as its terminal

https://github.com/MemoireMorte/Memo-1
22•sciences44•2d ago•2 comments

Rise Reforming (YC S26) Is Hiring

https://www.ycombinator.com/companies/rise-reforming/jobs/wJ9Q9nv-senior-chemical-process-engineer
1•george_rose25•4h ago

We Gave GPT 5.6 Sol a Real Business. It Lied, Spammed, and Lost $447

https://www.bottlenecklabs.com/blog/autonomously-run-businesses
214•Areibman•3h ago•126 comments

Show HN: Distilling DeepSeek into GPT-OSS doesn't transfer censorship. Try it

https://www.ctgt.ai/research/distillation-censorship-transfer
37•cgorlla•2h ago•28 comments

The Economic Benefit of Refactoring

https://martinfowler.com/articles/exploring-gen-ai/refactoring-economic-benefit.html
152•javaeeeee•5h ago•73 comments

Google will expand age checks on Android worldwide till the end of the year

https://android-developers.googleblog.com/2026/07/google-play-age-signals-api-safer-experiences.html
300•dmantis•10h ago•377 comments

Solving poker in custom WebGPU kernels

https://phulin.me/blog/poker/
22•patrickhulin•5h ago•4 comments

Launch HN: Prized (YC S26) – Let non-engineer staff build secure internal tools

https://prized.dev
61•marinoseliades•7h ago•36 comments

Why is everyone trying to build a solid-state battery?

https://www.construction-physics.com/p/why-is-everyone-trying-to-build-a
145•crescit_eundo•8h ago•171 comments

Hacker Public Radio

https://hackerpublicradio.org/
108•bmacho•6h ago•20 comments

GCC steering committee announces AI policy

https://lwn.net/Articles/1086041/
193•arto•9h ago•218 comments

Upper stage impacting the moon on 2026 August 5

https://www.projectpluto.com/25010d.htm
138•ryannevius•7h ago•37 comments

The lost civic life of movie rental stores

https://thereader.mitpress.mit.edu/the-lost-civic-life-of-movie-rental-stores/
76•facundo_olano•6h ago•124 comments

Bad Apple but It's Traceroute

https://jssfr.de/2026-07-27-bad-apple-but-traceroute.html
8•jssfr•3d ago•0 comments

Show HN: Optimize and serve models with Fable quality at half the cost

https://github.com/experientiallabs/world-model-optimizer
54•SilenN•3d ago•25 comments

Show HN: Supapool – a Supabase per coding agent in ~400 ms

https://supapool.io/
21•kevo1ution•1d ago•0 comments

Why DNA damage from smoking and UV rays cause cancer in some but not others

https://www.cam.ac.uk/research/news/study-reveals-why-dna-damage-from-smoking-and-uv-rays-may-cau...
69•gmays•6h ago•77 comments

How to Mount a Balcony Awning (2025)

https://solar.lowtechmagazine.com/2025/07/how-to-mount-a-balcony-awning/
50•karakoram•5d ago•6 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.