frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

FDA authorizes first wearable device that monitors ketone and blood sugar levels

https://www.fda.gov/news-events/press-announcements/fda-authorizes-first-wearable-device-continuo...
149•sunnynagra•2h ago•98 comments

Apple introduces M6 and M5 Ultra

https://www.apple.com/newsroom/2026/08/apple-introduces-m6-and-m5-ultra-for-a-big-leap-in-perform...
860•interpol_p•9h ago•790 comments

OpenAI Jalapeño: Better than Nvidia Blackwell

https://newsletter.semianalysis.com/p/openai-jalapeno-better-than-nvidia
219•bmulholland•7h ago•150 comments

New Mac Studio with M5 Max and M5 Ultra

https://www.apple.com/newsroom/2026/08/apple-introduces-new-mac-studio-with-m5-max-and-m5-ultra/
659•interpol_p•9h ago•403 comments

Black hole singularity is a surface not a point

https://arxiv.org/abs/2608.21590
145•raattgift•5h ago•101 comments

Show HN: I made a Raspberry with Qwen my local car AI

https://github.com/ThinkOffApp/CarWatch
66•petruspennanen•6h ago•15 comments

New Mac mini, featuring M6 and M5 Pro

https://www.apple.com/newsroom/2026/08/apple-unveils-a-more-powerful-mac-mini-featuring-the-all-n...
388•runako•8h ago•216 comments

Run OpenBSD on DigitalOcean for $4/month

https://nil.wallyjones.com/run-openbsd-on-digitalocean-for-4month/
90•speckx•4h ago•35 comments

When str.lower() is a security vulnerability in Python – Seth Larson

https://sethmlarson.dev/when-str-lower-is-a-security-vulnerability
16•rbanffy•1h ago•8 comments

C2PA Cameras Do Not Survive Contact with Reality

https://www.da.vidbuchanan.co.uk/blog/android-c2pa.html
28•Retr0id•2h ago•7 comments

Bomb fishing is wreaking havoc on Indonesia's coral reefs

https://e360.yale.edu/digest/bomb-fishing-coral-reefs
231•speckx•7h ago•126 comments

Nitter project received cease and desist

https://github.com/zedeus/nitter/issues/1442
424•Banditoz•4h ago•297 comments

Dolly Parton has died

https://www.theguardian.com/music/2026/aug/25/dolly-parton-country-singer-dead
959•helsinkiandrew•4h ago•143 comments

Python's pre-declared constants are kinda weird

https://sebsite.pw/w/20260801-pythonconstants.html
4•rbanffy•25m ago•0 comments

Clara (YC P26) is hiring a growth engineer to bring AI doctors to market

https://www.ycombinator.com/companies/clara-2/jobs/8snci6k-founding-full-stack-growth-engineer
1•gfavvas•4h ago

Show HN: LatticeDB – Like SQLite but for graph databases

https://github.com/jeffhajewski/latticedb
79•smiths1999•5h ago•26 comments

Building a backyard office, the build and cost breakdown

https://www.imkylelambert.com/articles/building-a-backyard-office-the-build-and-cost-breakdown
222•surprisetalk•7h ago•164 comments

My Friend Aaron

https://rorz.io/writing/my-friend-aaron
363•sarreph•5h ago•90 comments

Tooltips need a delay, and then they need to skip it

https://blog.master.dev/tooltips-need-a-delay-and-then-they-need-to-skip-it/
86•ibobev•5h ago•17 comments

Firefox 157 will include JPEG XL by default on all platforms

https://groups.google.com/a/mozilla.org/g/dev-platform/c/3YMV4MS34KA?pli=1
204•yboris•4h ago•44 comments

Don't Wordle

https://dontwordle.com/
276•Hbruz0•10h ago•110 comments

Starbase, LA

https://www.spacex.com/sites/starbase-la
176•bilsbie•5h ago•285 comments

Tracking Costco gas prices

https://www.jack.bio/blog/costco-gas-tracking
54•lafond•1d ago•51 comments

Behaviorally fingerprinting Ox Alpha's provenance

https://www.ctgt.ai/research/behaviorally-fingerprinting-ox-alphas-provenance
20•cgorlla•6h ago•13 comments

Visualizing Binary Files

https://movq.de/blog/postings/2026-08-05/0/POSTING-en.html
59•zdw•1d ago•14 comments

A new ceiling for Λ: the de Bruijn–Newman constant

https://www.judegomila.com/posts/riemann-lambda-0.1787854
43•judegomila•5h ago•16 comments

Fuzzing the Gleam Compiler

https://www.kurz.net/posts/fuzzing-gleam-compiler
39•crowdhailer•5h ago•3 comments

Show HN: Lightweight system monitor for Linux VPS written in Go

https://github.com/leodeim/vpsmon
35•ygagaga•4h ago•13 comments

Warnock: Harnessing GPU geometry amplification for vector graphics

https://dl.acm.org/doi/pdf/10.1145/3820012
36•coffeeaddict1•6h ago•2 comments

Show HN: I wrote a BASIC interpreter that boots on UEFI machines

https://tarjan.itch.io/thoreaubasic
119•Gorsefound•2d ago•37 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.