frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Google Has Removed MV2 Extensions from the Chrome Web Store, Including UBO

https://webiterate.dev/google-removed-extensions-ublock-origin-108/
433•twapi•3h ago•350 comments

Run macOS Software on Linux

https://www.darlinghq.org/
68•Bluestein•2h ago•17 comments

Evidence of Fraud in an Influential Study About Procrastination

https://datacolada.org/138
37•Anon84•1h ago•14 comments

I turned my security cameras into an automatic bird identification system

https://jasontucker.blog/how-i-turned-my-security-cameras-into-an-automatic-bird-identification-s...
352•speckx•8h ago•92 comments

'Mad honey' that can stop your heart is being sold online

https://phys.org/news/2026-08-mad-honey-heart-sold-online.html
121•samizdis•3d ago•74 comments

Playa Phone

https://playaphone.com/
479•cutoff•10h ago•177 comments

A walkable ASCII cyberpunk city in one HTML file [video]

https://www.youtube.com/watch?v=3YtygAx_C6A
191•keithcarolus•6h ago•28 comments

Lion-man – the oldest confirmed statue ever discovered

https://en.wikipedia.org/wiki/Lion-man
36•gurjeet•2d ago•10 comments

Terence Tao explains 6 essential mathematical concepts [video]

https://www.youtube.com/watch?v=OOMx2BHHWtE
187•matthewsinclair•1d ago•22 comments

Develop Cross-Platform CLI and GUI Tools with Tcl/Tk

https://cgicoffee.com/blog/2026/04/tcl-tk-develop-cross-platform-cli-gui-tools-tutorial-guide
24•aryonoco•2h ago•16 comments

Show HN: Laser Graffiti

https://laser.consti.de
112•con•2d ago•24 comments

Dwarf Fortress is getting the mother of all magic updates

https://www.rockpapershotgun.com/dwarf-fortress-is-getting-the-mother-of-all-magic-updates-extend...
282•Tomte•4d ago•104 comments

Apple caught off guard by AI demand for Mac Mini and Mac Studio

https://www.macrumors.com/2026/08/30/apple-unexpected-mac-mini-and-studio-demand/
283•thm•12h ago•321 comments

Autonomous (YC F25) is hiring engineers

1•dkobran•3h ago

Smartphone LED detects hidden cameras with AI

https://www.chosun.com/english/industry-en/2026/08/30/SBFXUIJQYZEARKP5T4FBAY25HQ/
138•geox•1d ago•36 comments

RavynOS: Pre-alpha open-source OS based on Darwin, FreeBSD, Apple open-source

https://ravynos.com/
160•Bluestein•8h ago•99 comments

Visualizing Combos in Judo in R

https://www.r-bloggers.com/2025/05/the-dynamics-of-the-gentle-way-exploring-judo-attack-combinati...
7•asaiacai•5d ago•0 comments

Cheap GPS jammers are filling the world with navigation dead zones

https://www.wsj.com/tech/gps-jammers-dead-zones-e76f3261
59•vinnyglennon•1d ago•67 comments

ChatGPT Work Tool and Skill Reference

https://codex-tool-reference.simonw.chatgpt.site/
177•ijidak•10h ago•50 comments

I think the military commissary's freezers were hacked

https://signalandsilence.substack.com/p/i-think-someone-hacked-the-commissary
238•jcurbo•13h ago•138 comments

Reverse engineering my ADHD test

https://nullpt.rs/reverse-engineering-adhd-test
140•hazebooth•4d ago•61 comments

Claude × retrocomputing: emulating a QIC-117 tape drive

https://dmitrybrant.com/2026/08/23/claude-x-retrocomputing-emulating-a-qic-117-tape-drive
17•zdw•1w ago•11 comments

Internet centralization and the original sin of NAT

https://dreamstation.systems/personal/ntppost.html
172•robinpie•22h ago•130 comments

The safest job from AI may be writing

http://muratbuffalo.blogspot.com/2026/08/the-safest-job-from-ai-may-be-writing.html
94•ilreb•6h ago•132 comments

Launch HN: Almanac (YC S26) – AI that knows your company

https://usealmanac.com/
45•kushagrchitkar•9h ago•41 comments

How we configured OpenTelemetry logs in Rails

https://www.sixpatterns.com/blog/how-we-configured-opentelemetry-logs-in-rails
16•__vivek•3h ago•3 comments

Launch HN: Hebbian Robotics (YC S26) – Build scalable robotics data pipelines

https://github.com/Hebbian-Robotics/hflow
37•kstonekuan•9h ago•10 comments

No country for mediocre mathematicians

https://garvvee.substack.com/p/no-country-for-mediocre-mathematicians
141•reasonableklout•1d ago•79 comments

Since it was stripped of planetary status, Pluto’s defenders have been fighting

https://www.theguardian.com/science/2026/aug/31/forbidden-planet-was-plutos-2006-demotion-a-big-m...
48•ziofill•18h ago•139 comments

Show HN: We built the smallest dual-band aircraft tracker

https://pantsforbirds.com/the-worlds-smallest-dual-band-ads-b-receiver-module/
76•CoolNamesAllTkn•5d ago•21 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.