frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

GLM-5.4: Toward Generalized Coding with Our First Loop Transformer

https://z.ai/blog/glm-5.4
229•foohis•2h ago•102 comments

Free alternative TV network built from the Internet Archive's forgotten videos

https://spelunkr.tv
604•SockThief•11h ago•110 comments

XNU Linux: Full OS X GUI Userspace on Linux

https://github.com/AFK-surf/xnulinux
397•mmastrac•8h ago•185 comments

Yes, 17M lines of Lean is a lot

https://micjm.com/blog/yes-17m-lines-of-lean-is-a-lot/
133•seizethecheese•7h ago•154 comments

A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth

https://www.gpupartner.com/blog/beginners-guide-local-ai-inkling-qwen-unsloth
568•Retell15•15h ago•238 comments

Elixir HLS makes FPGA circuits from functions written in Elixir

https://github.com/elixir-hls/elixir-hls
41•kristianpaul•2d ago•0 comments

The Birds of GTA 6: A Field Guide to Vice City and Leonida's Wildlife

https://www.audubon.org/magazine/birds-of-gta-6-field-guide-vice-city-wildlife
535•gaws•17h ago•282 comments

Masullo on the Riemann Hypothesis

https://johncarlosbaez.wordpress.com/2026/11/22/masullo-on-the-riemann-hypothesis/
250•xiaoyu2006•1d ago•229 comments

Perplexity and Intelligence

https://openai.com/index/perplexity-and-intelligence/
613•acossta•19h ago•406 comments

Cathedral floor emerges in Sudan, revealing one of the biggest medieval churches

https://apnews.com/article/sudan-antiquities-nubia-cathedral-1b16f67da881ee5592de4481ee55c527
271•graemep•4d ago•85 comments

A Partial Evaluator for C

https://phoenix.labri.fr/software/tempo/
76•measurablefunc•7h ago•20 comments

MRAM Basics: How Magnetic Memory Is Replacing Embedded Flash

https://www.allaboutcircuits.com/technical-articles/mram-basics-how-magnetic-memory-is-replacing-...
4•giuliomagnifico•2d ago•0 comments

The next circle of security hell

https://blogs.gentoo.org/mgorny/2026/10/27/the-next-circle-of-security-hell/
6•qtqtqt•1h ago•0 comments

Brake Check: Hijacking Trailer Brakes over Bluetooth

https://elementdigital.com.au/blog/brake-check-trailer-brakes-over-bluetooth/
31•DeepLogin•2d ago•29 comments

Assume People Are Not Interested in Your Blog Post

https://danielsada.tech/blog/assume-people-are-not-interested-in-your-blog-post/
228•dshacker•16h ago•115 comments

Treemap of the Riemann Hypothesis Lean Proof

https://pengowray.github.io/riemann-zeta-proof-visualizer/
106•pengowray•10h ago•39 comments

CollectWise (YC F24) Is Hiring

https://www.ycombinator.com/companies/collectwise/jobs/lgobCse-founding-customer-success-manager
1•OBrien_1107•5h ago

GL.iNet Security Notice 2026-11-20

https://www.gl-inet.com/en-us/blogs/blog/glinet-security-notice-2026-11-20
220•gregsadetsky•13h ago•103 comments

A miniature San Francisco with live buses, planes and boats

https://smallsf.com/
294•dutilh•16h ago•96 comments

The struggle for freedom: How BSD escaped AT&T licensing

https://fosscomics.com/posts/16.%20BSD%20Unix%20Part%206%20-%20The%20Struggle%20for%20Freedom/
130•joonehur•15h ago•42 comments

The Usefulness of Useless Knowledge [pdf] (1939)

https://www.ias.edu/sites/default/files/library/UsefulnessHarpers.pdf
138•hectormauer•14h ago•28 comments

The New Docker: Built to Run on Trust

https://www.docker.com/blog/meet-the-new-docker-built-to-run-on-trust/
57•peer2pay•9h ago•115 comments

LittleBit: Ultra Low-Bit Quantization via Latent Factorization (2025)

https://arxiv.org/abs/2506.13771
56•kakadu•3d ago•9 comments

Nyx, the Oldest Internet Service Provider

https://nyx.net/
145•o_-_o•16h ago•24 comments

Enjoy this guy getting bricked over the detail of towers in GTA6

https://bsky.app/profile/floppyadult.com/post/3n2tgw7rofc2v
59•doener•3h ago•16 comments

Show HN: Drive around my village in 3D

https://cherwellvalleymotorclub.app
46•johnwards•2d ago•38 comments

The Unlicensed Gospel: Wisdom Tree's Bible Games on the Game Boy

https://www.gameboymuseum.com/single-post/the-unlicensed-gospel-wisdom-tree-s-bible-games-on-the-...
57•speckx•3d ago•39 comments

Show HN: I built a game where you are an LLM's subagent

https://github.com/gulivan/worker755
331•ivantgam•22h ago•79 comments

What Happened to Silicon Valley?

https://www.oreilly.com/radar/what-happened-to-silicon-valley/
709•greenyouse•17h ago•382 comments

Toyota, Nissan, and Honda to standardize parts to lower costs

https://www.caranddriver.com/news/a74490092/toyota-nissan-honda-standardize-parts-lower-costs/
1326•zdw•1d ago•710 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.