frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

ZCode: Claude Code from the Makers of GLM

https://zcode.z.ai/cn
209•handfuloflight•2h ago•98 comments

For first time, a cell built from scratch grows and divides

https://www.quantamagazine.org/for-the-first-time-a-cell-built-from-scratch-grows-and-divides-202...
590•defrost•6h ago•205 comments

What to Learn to Be a Graphics Programmer

https://blog.demofox.org/2026/07/01/what-to-learn-to-be-a-graphics-programmer/
143•atan2•3h ago•58 comments

FFmpeg 9.1's new AAC encoder

https://hydrogenaudio.org/index.php/topic,129691.0.html
185•ledoge•7h ago•66 comments

Physical disc production ending in Jan 2028 for new games on PlayStation

https://blog.playstation.com/2026/07/01/physical-disc-production-ending-in-january-2028-for-new-g...
455•Tiberium•8h ago•511 comments

Proliferate (YC S25) Is Hiring

https://www.ycombinator.com/companies/proliferate/jobs/mMHvKR9-founding-product-engineer
1•pablo24602•13m ago

Internal Combustion Engine

https://ciechanow.ski/internal-combustion-engine/
234•StefanBatory•8h ago•50 comments

Box3D, an open source 3D physics engine

https://box2d.org/posts/2026/06/announcing-box3d/
342•makepanic•9h ago•80 comments

Monetization Gateway

https://blog.cloudflare.com/monetization-gateway/
198•soheilpro•7h ago•108 comments

How We Made IPFS Content Publishing 10x Faster

https://probelab.io/blog/optimistic-provide/
115•dennis-tra•5h ago•33 comments

Show HN: Z-Jail – A 130 KB Linux sandbox-C99 with 7 defense layers and zero deps

https://github.com/Division-36/Z-Jail/
16•Zierax•1h ago•14 comments

Ask HN: Who is hiring? (July 2026)

119•whoishiring•6h ago•135 comments

Mortality associated with non-optimal ambient temperatures from 2000 to 2019

https://www.researchgate.net/publication/353058947_Global_regional_and_national_burden_of_mortali...
35•simonebrunozzi•3h ago•3 comments

One KW wind turbine without civil engineering

https://www.windtowatt.com/index-en.html
10•skywal_l•29m ago•4 comments

Hanami 3.0: In Full Bloom

https://hanakai.org/blog/2026/06/30/hanami-3-0-in-full-bloom
44•PuercoPop•3h ago•8 comments

Ask HN: Who wants to be hired? (July 2026)

86•whoishiring•6h ago•189 comments

1-Bit Pixel Art Emojis

https://hypertalking.com/2023/05/15/1-bit-pixel-art-emojis/
117•surprisetalk•6d ago•16 comments

Claude Fable 5 Promotional Access

https://support.claude.com/en/articles/15424964-claude-fable-5-promotional-access
81•zbikowski•1h ago•56 comments

Show HN: Searchable directory of 22k+ products from worker-owned co-ops

https://www.workerowned.info/
4•IESAI_ski•25m ago•1 comments

Fable 5 Is Back

https://twitter.com/claudeai/status/2072402636813607381
166•mfiguiere•1h ago•126 comments

A complete ClickHouse OLAP engine, compiled to WebAssembly

https://wasm.chdb.io/
35•porridgeraisin•4h ago•4 comments

Building Gin: Simple over Easy

https://manualmeida.dev/articles/gin-simple-over-easy/
51•manucorporat•3h ago•16 comments

Most rewrites serve the engineer, not the business

https://anatoliybabushka.com/blog/when-to-rewrite-working-code.html
16•bbsnly•3h ago•15 comments

Sony Deletes 551 Movies PlayStation Owners Paid For

https://reclaimthenet.org/sony-deletes-551-studiocanal-movies-playstation-owners-paid-for
416•bilsbie•6h ago•191 comments

Generating Images with a 2025 Android

https://www.duration.ai/blog/generating-images-with-a-2025-android
8•sudb•1d ago•0 comments

Launch HN: Parsewise (YC P25) – Reason Across Documents with an API

40•gergelycsegzi•7h ago•38 comments

Fixing a kubelet memory leak in Kubernetes 1.36

https://heyoncall.com/blog/fixing-kubernetes-kubelet-memory-leak
60•compumike•18h ago•12 comments

Reduce GVisor Cold Starts with GPU Snapshotting

https://cerebrium.ai/blog/reducing-gpu-cold-starts-with-memory-snapshots-restoring-cuda-workloads...
43•jono_irwin•4h ago•15 comments

Apple 'Hide My Email' vulnerability reveals peoples' real email addresses

https://easyoptouts.com/guides/apple-hide-my-email-is-leaking-email-addresses
212•sashk•10h ago•46 comments

Asahi Linux 7.1 Progress Report

https://asahilinux.org/2026/06/progress-report-7-1/
503•pantalaimon•11h ago•182 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.