frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Creatine raise brain energy levels and slow Alzheimer's cognitive decline by 30%

https://thesciverse.org/scientists-found-that-the-creatine-supplement-millions-take-for-muscle-ga...
283•MrJagil•3h ago•196 comments

Cloudflare Turnstile requiring fingerprintable WebGL

https://hacktivis.me/articles/cloudflare-turnstile-webgl-fingerprinting
310•HypnoticOcelot•5h ago•171 comments

1-Bit Bonsai Image 4B Image Generation for Local Devices

https://prismml.com/news/bonsai-image-4b
159•modinfo•4h ago•60 comments

Dav2d

https://jbkempf.com/blog/2026/dav2d/
336•captain_bender•7h ago•116 comments

The Speed of Prototyping in the Age of AI

https://darylcecile.net/notes/speed-of-prototyping-age-of-ai
47•mooreds•3h ago•35 comments

Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock

https://lwn.net/Articles/104185/
24•luu•1h ago•14 comments

United Airlines 767 returns to Newark after Bluetooth name sparks alert

https://simpleflying.com/united-airlines-767-returns-newark-bluetooth-name-alert/
140•Eridanus2•6h ago•195 comments

Codex just found a "workaround" of not having sudo on my PC

https://twitter.com/i/status/2060746160558543217
56•thunderbong•42m ago•16 comments

Restartable Sequences

https://justine.lol/rseq/
118•grappler•5h ago•26 comments

Show HN: Streambed – Stream Postgres to Iceberg on S3, Supports Postgres Wire

https://github.com/viggy28/streambed
8•vira28•57m ago•0 comments

London's Free Roof Terraces

https://diamondgeezer.blogspot.com/2026/05/londons-free-roof-terraces.html
228•zeristor•12h ago•124 comments

The Website Specification

https://specification.website/
378•k1m•12h ago•159 comments

Having your insulin pump die while you're on vacation

https://blog.lauramichet.com/what-its-like-to-have-the-machine-that-keeps-you-alive-die-while-you...
86•speckx•3d ago•100 comments

Steam Deck sells out in North America within 24 hours of price hike

https://arstechnica.com/gaming/2026/05/despite-price-hike-steam-deck-is-already-sold-out-in-north...
14•frutiger•28m ago•3 comments

Linux/M68k

http://www.linux-m68k.org/
15•doener•2d ago•1 comments

Deflock hits 100k ALPRs Mapped in USA

https://deflock.org/
76•pilingual•2h ago•22 comments

Daily pill can double survival time for deadliest cancer, trial shows

https://www.theguardian.com/society/2026/may/31/daily-pill-daraxonrasib-double-survival-time-panc...
103•c-oreills•3h ago•17 comments

FROST: Fingerprinting Remotely using OPFS-based SSD Timing [pdf]

https://hannesweissteiner.com/pdfs/frost.pdf
29•simjnd•5h ago•11 comments

Backpressure is all you need

https://www.lucasfcosta.com/blog/backpressure-is-all-you-need
84•lucasfcosta•7h ago•68 comments

Security Envelope Pattern collection – S.E.C.R.E.T

https://secret-archive.org/
75•ColinWright•2d ago•8 comments

Websites have a new way to spy on visitors: analyzing their SSD activity

https://arstechnica.com/security/2026/05/websites-have-a-new-way-to-spy-on-visitors-analyzing-the...
35•Brajeshwar•3d ago•11 comments

I put a datacenter GPU in my gaming PC

https://blog.tymscar.com/posts/v100localllm/
205•birdculture•5h ago•134 comments

Shantell Sans (2023)

https://shantellsans.com/process
376•aleda145•21h ago•43 comments

The AV2 Video Standard Has Released (Final v1.0 Specification)

https://av2.aomedia.org
331•ksec•21h ago•143 comments

Chibil: A C compiler targeting .NET IL

https://github.com/MichalStrehovsky/chibil
38•algorithmsRcool•3h ago•4 comments

You weren't meant to have a boss (2008)

https://paulgraham.com/boss.html
87•downbad_•6h ago•90 comments

Telli (YC F24) is hiring in engineering, design, and GTM [Berlin, on-site]

https://hi.telli.com/join-us
1•sebselassie•12h ago

One year of Roto, a compiled scripting language for Rust

https://blog.nlnetlabs.nl/one-year-of-roto-the-compiled-scripting-language-for-rust/
101•Hasnep•2d ago•26 comments

Show HN: Atomic Editor – Obsidian-style live preview for CodeMirror 6

https://kenforthewin.github.io/atomic-editor/
37•kenforthewin•7h ago•9 comments

A Gentle Introduction to Lattice-Based Cryptography [pdf]

https://cryptography101.ca/wp-content/uploads/lattice-based-cryptography.pdf
155•jayhoon•2d ago•15 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.