frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Box of Secrets: Discreetly modding an apartment intercom to work with Apple Home

https://www.jackhogan.me/blog/box-of-secrets/
46•jackhogan11•17h ago•7 comments

Epoch confirms GPT5.4 Pro solved a frontier math open problem

https://epoch.ai/frontiermath/open-problems/ramsey-hypergraphs
241•in-silico•4h ago•157 comments

Log File Viewer for the Terminal

https://lnav.org/
15•wiradikusuma•57m ago•2 comments

Autoresearch on an old research idea

https://ykumar.me/blog/eclip-autoresearch/
331•ykumards•11h ago•72 comments

BIO – The Bao I/O Co-Processor

https://www.crowdsupply.com/baochip/dabao/updates/bio-the-bao-i-o-co-processor
15•hasheddan•2d ago•4 comments

FCC updates covered list to include foreign-made consumer routers

https://www.fcc.gov/document/fcc-updates-covered-list-include-foreign-made-consumer-routers
278•moonka•9h ago•187 comments

iPhone 17 Pro Demonstrated Running a 400B LLM

https://twitter.com/anemll/status/2035901335984611412
556•anemll•15h ago•257 comments

Pompeii's battle scars linked to an ancient 'machine gun'

https://phys.org/news/2026-03-pompeii-scars-linked-ancient-machine.html
61•pseudolus•3d ago•12 comments

Gerd Faltings, who proved the Mordell conjecture, wins the Abel Prize

https://www.scientificamerican.com/article/gerd-faltings-mathematician-who-proved-the-mordell-con...
16•digital55•4d ago•2 comments

Abusing Customizable Selects

https://css-tricks.com/abusing-customizable-selects/
83•speckx•5d ago•4 comments

Show HN: Cq – Stack Overflow for AI coding agents

https://blog.mozilla.ai/cq-stack-overflow-for-agents/
111•peteski22•14h ago•31 comments

IRIX 3dfx Voodoo driver and glide2x IRIX port

https://sdz-mods.com/index.php/2026/03/23/irix-3dfx-voodoo-driver-glide2x-irix-port/
61•zdw•7h ago•5 comments

Claude Code Cheat Sheet

https://cc.storyfox.cz
295•phasE89•8h ago•94 comments

Sunsetting the Techempower Framework Benchmarks

https://github.com/TechEmpower/FrameworkBenchmarks/issues/10932
30•nbrady•4h ago•4 comments

Dune3d: A parametric 3D CAD application

https://github.com/dune3d/dune3d
135•luu•1d ago•41 comments

The Resolv hack: How one compromised key printed $23M

https://www.chainalysis.com/blog/lessons-from-the-resolv-hack/
80•timbowhite•8h ago•107 comments

Finding all regex matches has always been O(n²)

https://iev.ee/blog/the-quadratic-problem-nobody-fixed/
187•lalitmaganti•4d ago•46 comments

How I'm Productive with Claude Code

https://neilkakkar.com/productive-with-claude-code.html
165•neilkakkar•9h ago•100 comments

Ju Ci: The Art of Repairing Porcelain

https://thesublimeblog.org/2025/03/13/ju-ci-the-ancient-art-of-repairing-porcelain/
81•lawrenceyan•2d ago•8 comments

TI-89 Height-Mapped Raycaster

https://github.com/dzoba/ti-89-raycasting-with-z
53•zoba•4d ago•4 comments

Windows 3.1 tiled background .bmp archive

https://github.com/andreasjansson/win-3.1-backgrounds
219•justsomehnguy•7h ago•62 comments

An incoherent Rust

https://www.boxyuwu.blog/posts/an-incoherent-rust/
164•emschwartz•15h ago•76 comments

Local Stack Archived their GitHub repo and requires an account to run

https://github.com/localstack/localstack
184•ecshafer•11h ago•103 comments

Trivy under attack again: Widespread GitHub Actions tag compromise secrets

https://socket.dev/blog/trivy-under-attack-again-github-actions-compromise
187•jicea•1d ago•67 comments

Microsoft blocks trick to unlock native NVMe driver, but workarounds still exist

https://www.tomshardware.com/software/windows/microsoft-blocks-the-registry-hack-trick-that-unloc...
19•josephcsible•1h ago•2 comments

A retro terminal music player inspired by Winamp

https://github.com/bjarneo/cliamp
76•mkagenius•9h ago•14 comments

I built an AI receptionist for a mechanic shop

https://www.itsthatlady.dev/blog/building-an-ai-receptionist-for-my-brother/
249•mooreds•19h ago•272 comments

BIO: The Bao I/O Coprocessor

https://www.bunniestudios.com/blog/2026/bio-the-bao-i-o-coprocessor/
142•zdw•3d ago•30 comments

Ubisoft's Death by a Thousand Cuts

https://www.thegamebusiness.com/p/ubisofts-death-by-a-thousand-cuts
9•ilamont•4h ago•1 comments

An unsolicited guide to being a researcher [pdf]

https://emerge-lab.github.io/papers/an-unsolicited-guide-to-good-research.pdf
183•sebg•4d ago•23 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•10mo ago

Comments

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