frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Linux on the Fujitsu Lifebook U729

https://borretti.me/article/linux-on-the-fujitsu-lifebook-u729
31•ibobev•1h ago•18 comments

The Nature of the Beast: Charles Le Brun's Human-Animal Hybrids (1806)

https://publicdomainreview.org/collection/le-brun-human-animal-hybrids/
22•Petiver•5d ago•3 comments

Our investigation into the suspicious pressure on Archive.today

https://adguard-dns.io/en/blog/archive-today-adguard-dns-block-demand.html
493•immibis•5h ago•164 comments

The Internet Is Cool. Thank You, TCP

https://cefboud.com/posts/tcp-deep-dive-internals/
172•signa11•9h ago•80 comments

Weighting an Average to Minimize Variance

https://www.johndcook.com/blog/2025/11/12/minimum-variance/
4•ibobev•54m ago•0 comments

AI World Clocks

https://clocks.brianmoore.com/
1188•waxpancake•21h ago•340 comments

Messing with Scraper Bots

https://herman.bearblog.dev/messing-with-bots/
112•HermanMartinus•8h ago•39 comments

One Handed Keyboard

https://github.com/htx-studio/One-Handed-Keyboard
74•doppp•6h ago•64 comments

So, you want to design your own language? (2017)

https://cs.lmu.edu/~ray/notes/languagedesignnotes/
120•veqq•10h ago•79 comments

Streaming AI Agent Desktops with Gaming Protocols

https://blog.helix.ml/p/technical-deep-dive-on-streaming
26•quesobob•1w ago•4 comments

Unofficial Microsoft Teams client for Linux

https://github.com/IsmaelMartinez/teams-for-linux
204•basemi•1w ago•190 comments

A new Google model is nearly perfect on automated handwriting recognition

https://generativehistory.substack.com/p/has-google-quietly-solved-two-of
408•scrlk•4d ago•229 comments

Activeloop (YC S18) Is Hiring MTS(Back End)and AI Search Engineer

https://careers.activeloop.ai/
1•davidbuniat•4h ago

Lawmakers want to ban VPNs and have no idea what they're doing

https://www.eff.org/deeplinks/2025/11/lawmakers-want-ban-vpns-and-they-have-no-idea-what-theyre-d...
400•gslin•1d ago•205 comments

Can text be made to sound more than just its words? (2022)

https://arxiv.org/abs/2202.10631
30•tobr•1w ago•17 comments

Strap Rail

https://www.construction-physics.com/p/strap-rail
5•juliangamble•1w ago•0 comments

History and use of the Estes AstroCam 110

https://www.dembrudders.com/history-and-use-of-the-estes-astrocam-110.html
20•mmmlinux•1w ago•4 comments

Go's Sweet 16

https://go.dev/blog/16years
192•0xedb•17h ago•120 comments

Löb and Möb: Loops in Haskell (2013)

https://github.com/quchen/articles/blob/master/loeb-moeb.md
71•fanf2•1w ago•12 comments

Kagi Bloopers – Search Results Gone Wrong

https://help.kagi.com/kagi/bloopers/
142•embedding-shape•3h ago•34 comments

HipKittens: Fast and furious AMD kernels

https://hazyresearch.stanford.edu/blog/2025-11-09-hk
208•dataminer•1d ago•63 comments

SSL Configuration Generator

https://ssl-config.mozilla.org/
208•smartmic•18h ago•61 comments

'No One Lives Forever' turns 25 and you still can't buy it legitimately

https://www.techdirt.com/2025/11/13/no-one-lives-forever-turns-25-you-still-cant-buy-it-legitimat...
299•speckx•23h ago•164 comments

All praise to the lunch ladies

https://bittersoutherner.com/issue-no-12/all-praise-to-the-lunch-ladies
227•gmays•20h ago•131 comments

How to write type-safe generics in C

https://raphgl.github.io/blog/generics-in-c.html
32•todsacerdoti•2h ago•31 comments

Spec-Driven Development: The Waterfall Strikes Back

https://marmelab.com/blog/2025/11/12/spec-driven-development-waterfall-strikes-back.html
165•vinhnx•8h ago•146 comments

Blending SQL and Python with Sqlorm

https://hyperflask.dev/blog/2025/11/11/blending-sql-and-python-with-sqlorm/
34•emixam•4d ago•8 comments

Driving TFEL with RP2040: Offloading the CPU step by step (2021)

https://www.zephray.me/post/rpi_pico_driving_el/
18•starkparker•6d ago•4 comments

Waymo Was on a Roll in San Francisco. Then One of Its Cars Killed a Cat

https://www.nytimes.com/2025/11/15/us/waymo-san-francisco-kit-kat.html
10•donohoe•1h ago•1 comments

No Leak, No Problem – Bypassing ASLR with a ROP Chain to Gain RCE

https://modzero.com/en/blog/no-leak-no-problem/
98•todsacerdoti•16h ago•7 comments
Open in hackernews

How to write type-safe generics in C

https://raphgl.github.io/blog/generics-in-c.html
32•todsacerdoti•2h ago

Comments

self_awareness•1h ago
Well, another option would be to use a C++ compiler, which supports templates, but limit the use of classes through a coding convention standard.
lelanthran•1h ago
> Well, another option would be to use a C++ compiler, which supports templates, but limit the use of classes through a coding convention standard.

When the other option is "ask the developers to practice discipline", an option that doesn't require that looks awfully attractive.

That being said, I'm not a fan of the described method either. Maybe the article could have shown a few more uses of this from the caller perspective.

krupan•1h ago
"ask the developers to practice discipline" is a baseline requirement for coding in C
pjmlp•1h ago
Unfortunately the majority has failed to attend the temple classes on such practices.
lelanthran•1h ago
> "ask the developers to practice discipline" is a baseline requirement for coding in C

Sure, but since there's 10x more opaque footguns in C+++, there is much less discipline needed than when coding in C++.

The footguns in C are basically signed-integer over/underflows and memory errors. The footguns in C++ include all the footguns in C, and then add a ton more around object construction type, object destruction types, unexpected sharing of values due to silent and unexpected assignments, etc.

Just the bit on file-scope/global-scope initialisation alone can bite even experienced developers who are adding a new nonlocally-scoped instance of a new class.

Loudergood•53m ago
If only.
EPWN3D•8m ago
And it hasn't worked in practice. C unfortunately does not have a very big pit of success -- it's way too hard to do the right thing and way too easy to do the wrong thing.

The solution to this doesn't have to be "rewrite everything in Rust", but it does mean that you need to provide safe, easy implementations for commonly-screwed-up patterns. Then you're not asking people to be perfect C programmers; you're just asking them to use tools that are easier than doing the wrong thing.

krupan•1h ago
Not sure why this is down voted when the whole point of TFA is to torture the C language into doing something it can't really do. I guess there's an unspoken assumption in TFA that you are stuck using C and absolutely cannot use a different language, not even C++?
pjmlp•1h ago
C folks rather reproduce badly C++ than acknowledge its Typescript like improvements over C.
lelanthran•51m ago
> C folks rather reproduce badly C++ than acknowledge its Typescript like improvements over C

This is a rather crude misrepresentation; most C programmers who need a higher level of abstraction than C reach for Java, C# or Go over C++.

IOW, acknowledging that C++ has improvements over C still does not make the extra C++ footguns worth switching over.

When you gloss over the additional footguns, it looks like you're taking it personally when C programmers don't want to deal with those additional footguns.

After all, we don't choose languages based on which one offers the most freedom to blow your leg off, we tend to choose languages based on which ones have the most restrictions against blowing your leg off.

If your only criteria is "Where can I get the most features", then sure, C++ looks good. If your criteria is "Where are the fewest footguns", then C++ is at the bottom of the list.

pjmlp•47m ago
Nah, it is called life experience meeting those kind of persons since the 1990's, starting on BBS forums.

My criteria is being as safe as Modula-2 and Object Pascal, as bare minimum.

C++ offers the tools, whereas WG14 has made it clear they don't even bother, including turning down Dennis Ritchie proposal for fat pointers.

lelanthran•46m ago
>> looks like you're taking it personally

> it is called life experience meeting those kind of persons

Looks like you are confirming that you are taking it personally.

I don't understand why, though.

You cannot imagine a programmer that wants fewer footguns?

pjmlp•44m ago
Yes, when careless programmers are responsible for critical infrastructure systems, and rather take a YOLO attitude to systems programming.
lelanthran•36m ago
> Yes, when careless programmers are responsible for critical infrastructure systems, and rather take a YOLO attitude to systems programming.

Well, that's a novel take: "Opting for fewer footguns is careless". :-)

It's probably not news to you that your view is, to put it kindly, very rare.

pjmlp•20m ago
Is it? Ask the governments and respective cyber security agencies.

And to finish this, as I won't reply any further,

"A consequence of this principle is that every occurrence of every subscript of every subscripted variable was on every occasion checked at run time against both the upper and the lower declared bounds of the array. Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980 language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law."

-- C.A.R Hoare's "The 1980 ACM Turing Award Lecture"

pron•30m ago
C is sometimes used where C++ can't be. Exotic microcontrollers and other niche computing elements sometimes only have a C compiler. Richer, more expressive languages may also have additional disadvantages, and people using simpler, less expressive languages may want to enjoy some useful features that exist in richer languages without taking on all of their disadvantages, too. Point being, while C++ certainly has some clear benefits over C, it doesn't universally dominate it.

TS, on the other hand, is usable wherever JS is, and its disadvantages are much less pronounced.

pjmlp•24m ago
It isn't the 1980's any longer, there isn't a chip in such scenarios other than PIC class, even AVR get to use C++.
flashgordon•36m ago
Actually this was my first instinct too. Just limit what you use c++ for and write c code with templates and be done with it.

The problems I am guessing start when you are tempted into using the rest of the features one by one. You have generics. Well next let's get inheritance in. Now a bit of operator overloading. Then dealing with all kinds of smart pointers...

eptcyka•30m ago
What would be the detrimental effect of using smart pointers?
hawk_•35m ago
Is there a way to pass compiler switches to disable specific C++ features? Or other static analysis tools that break the build upon using prohibited features?
fweimer•27m ago
No two development groups agree on the desired features, so it would have to be a custom compiler plugin.

You could start with a Perl script that looks at the output of “clang++ -Xclang -ast-dump” and verifies that only permitted AST nodes are present in files that are part of the project sources.

EPWN3D•5m ago
It never seems to work out that way though. C++ is just too large a language, and it gets bigger with each revision. The minute you hire a senior/principal engineer who loves C++, they'll make the case to enable "just this one" feature, and before you know it, you've got a sprawling C++ code base, not a "C with a light dusting of C++" code base.
schaefer•1h ago
A more accurate title would be:

“How to write type safe generics using the C preprocessor”

lelanthran•1h ago
Having used this in production around 2004, I never really liked this approach - abusing the preprocessor this much shouldn't be necessary and the result is almost unreadable.

I think a better way is possible using `_Generic`[1]. Even though it would still use macros, the resulting code is much more readable.

---------------------------

[1] `_Generic` comes with its own problems too, of course.

synergy20•1h ago
or use nim metaprogramming, which will be transpiled to c
david2ndaccount•1h ago
I wrote a similar article in the past: https://www.davidpriver.com/ctemplates.html

I use this technique in my hobby projects as it has worked out the best for me of the options I’ve explored.

variadix•1h ago
You can create macro functions per generic function so something like Vector_New(int)(&v) expands to Vector_New_int(&v). It also looks less foreign (more like templates) than the G macro.
pjmlp•1h ago
Type safety, generics and C is a bit of oxymoron.
jesse__•1h ago
I wrote a metaprogramming language that adds another option to the list, for anyone that's interested : https://github.com/scallyw4g/poof
tester756•16m ago
Why they cannot add generics to C as first class citizen, so you don't have to abuse macros, preprocessing and other primitive techniques?
kevin_thibedeau•11m ago
I recommend m4 for doing this sort of thing. It's much easier to manipulate the generated source with its facilities than with the preprocessor.