frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

PHP2Shell: Exploitation Attempts and Remediation Trends

https://www.wiz.io/blog/php2shell-exploitation-so-far
87•acossta•1h ago•28 comments

Python's experimental JIT to be removed

https://lwn.net/SubscriberLink/1102102/0c00e4d550f25f8c/
200•f311a•3h ago•113 comments

Wikipedia's Cleanup of AI-Generated Content

https://spectrum.ieee.org/wikipedia-wikiproject-ai-writing-cleanup
188•rbanffy•4h ago•82 comments

AI promised less work. I've never worked more

https://oioannou.com/blog/ai-promised-less-work/
385•oorestisime•4h ago•342 comments

Here Be Monsters: What Do You Still Need to Know When Agents Do the Work?

https://blog.adrq.dev/here-be-monsters-what-do-you-still-need-to-know-when-agents-do-the-work
49•adrq•1h ago•13 comments

Giving chat feedback gives Anthropic your data

https://privacy.claude.com/en/articles/7996868-is-my-data-used-for-model-training
74•jonpizza•1h ago•37 comments

The US Government Is Hiding Secret Court Ruling About How It Spies on Americans

https://www.wired.com/story/the-us-government-is-hiding-a-secret-court-ruling-about-how-it-spies-...
109•helterskelter2•1h ago•14 comments

Software may be getting worse, but it used to be horrible

https://www.bitlog.com/2026/10/27/software-may-be-getting-worse-but-it-used-to-be-horrible/
194•jakevoytko•3h ago•146 comments

Three new discoveries in mathematics, computer science, and physics

https://openai.com/index/building-scientific-understanding-with-academic-communities/
1046•jonluca•17h ago•582 comments

The Mythical Man-Month in the Age of AI

https://j11g.com/the-mythical-man-month-in-the-age-of-ai
318•ilreb•8h ago•201 comments

Viral Polls Are Not Representative Polls

https://kevinreuning.com/blog/polling_virality.html
7•m-hodges•28m ago•1 comments

New iMac with M6

https://www.apple.com/imac/
87•notfried•2h ago•70 comments

Why Micron Is Suddenly Ditching 4F² DRAM as Rivals Double Down

https://hothardware.com/news/why-micron-is-suddenly-ditching-4f-dram
18•rbanffy•1d ago•2 comments

Gforth 1.0

https://gforth.org/manual/1.0/NEWS.html
89•joshcsimmons•4h ago•5 comments

The Exponential Time Hypothesis Is False [pdf]

https://github.com/openai/math/blob/main/preprints/The-Exponential-Time-Hypothesis-is-False-Octob...
726•vok•17h ago•257 comments

A Stackless Floodfill Automaton

https://t3x.org/files/floodfill.pdf
9•andsoitis•1d ago•2 comments

Roblox downloaded 145GB models from us (including adult content) without asking

https://open3dlab.com/news/roblox-downloaded-145-gb-of-models-from-our-sites/
370•choult•4h ago•220 comments

Sebastian Raschka's from-scratch video course on building reasoning models

https://magazine.sebastianraschka.com/p/building-reasoning-models
788•sgiannopoulos•1d ago•105 comments

188-Year-Old Mystery of Photography's First Human Subjects Solved

https://news.artnet.com/art-world/daguerre-photograph-subjects-location-2826596
29•bookofjoe•3d ago•6 comments

Alleged Israeli spy company targeted Starlink users

https://www.reuters.com/business/media-telecom/alleged-israeli-spy-company-heavily-targeted-starl...
60•mmaia•1h ago•6 comments

Kauldron: Modular, scalable library to train ML models

https://github.com/google-research/kauldron
17•nateb2022•1d ago•2 comments

Oldest GUI application that still runs on Windows 11

https://blog.enlyth.com/posts/oldest-windows-gui-app-win-11/
497•enlyth•21h ago•294 comments

Solar power is becoming bigger than nuclear

https://www.bbc.com/future/article/20261023-how-solar-became-bigger-than-nuclear
460•geox•23h ago•647 comments

I still teach OpenGL ES 3.0

https://eliasfarhan.ch/graphics/cpp/2026/01/27/why-i-teach-opengles.html
116•majorchord•13h ago•71 comments

CSS-Tricks has a new owner

https://css-tricks.com/css-tricks-has-a-new-owner/
526•edent•23h ago•109 comments

Type Server Protocol

https://github.com/microsoft/pylance-release/blob/main/docs/tsp/type-server-protocol.md
259•adamnemecek•21h ago•172 comments

How to grow a cacao tree at home (2024)

https://www.cocoterra.com/guide-on-how-to-grow-chocolate-at-home/
130•felipevb•1d ago•39 comments

Writing about pratt parsing so I remember it

https://www.unix.dog/~yosh/blog/2026-10-25_pratt-parsing.html
71•dverlaeckt80•9h ago•6 comments

A Printer Printing onto Paper

https://twitter.com/macrofying/status/2112904628509528219
175•MrBuddyCasino•4d ago•42 comments

Cross-request KV cache exposure in the GLM-5.3 Workers AI model (155 responses)

https://blog.cloudflare.com/kv-cache-exposure-remediation/
165•wondersky•16h ago•66 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.