I'm porting some code from POSIX to Windows. Fairly simple: poll(2) on STDIN_FILENO and on an FD for a UART. Set .events and check .revents. read() / write().

On Windows this involves waiting for events on handles, which is fine. Except, the wait-for-multiple interface only informs of the first event, so either the event list must be rebuilt without the event, or each subsequent event must be checked on it's own using the wait-single interface. This seems complex with no apparent benefit.

On Windows checking stdin seems to involve a special Console API which seems to provide "almost-fgets(STDIN_FILENO)" via ConsoleRead() , but I also seem to have to handle "CR key-up", and other keys, e.g. ctrl, also seems to generate unhandled events that must be peeked and discarded with ConsoleReadInput() to avoid blocking in ConsoleRead().

The UART is a whole other story, or rather more of the same. Everyone seems to say you need to use threads that block and then communicate using control events or use "async / overlapped IO" but my entire application is single threaded, and adding multiple new classes of software bugs to interface with a UART in 2026 seems nuts.

#swdev #windows #porting

RE: https://fosstodon.org/@nurkiewicz/116495340585962940

It’s all about the money and it always was. As AI vendors start charging what it actually costs instead of burning VC, this is going to change the story from „we’re gonna fire you for not using enough AI“ to „pleeeease use it only when it really helps“. Turns out, this is something, that well trained engineers can actually do.

#ai #anthropic #tokenmaxxing #swdev #programming

Good luck, „AI native“ shops.

#anthropic #claude #swdev #lockin

*New Article*

In the past weeks and months, some friends and colleagues send me articles and quotes from public figures talking about AI in one way or the other. Mostly, they talk about how everything will change and how AI will be the solution to all problems.

I decided to write a piece about this.

https://return.co.de/blog/articles/ai-the-trojan-horse/

#ai #nvidia #anthropic #oracle #swdev

return code - The Trojan Horse

This is the return code blog, tech and other stuff.

Getting Renovate to work in a yaml pipeline running in a corporate network with private artifact registries and proxies in place is just a lot of fun.

#developerdiaries #pleasekillme #swdev #devops

Working on fw for a microcontroller with 16k of RAM.

Today, in the same file I found two issues:

Function A: 7 byte malloc leaked 297 times, totaling 2079 bytes.

Function B: Putting a 2079 byte buffer on the stack (plus a second 512 byte buffer)

Both buffers had in common that they were not only trivially avoidable but actually ended up complicating things.

#swdev

„Auf dem Girokonto befindet sich derzeit kein Kraftwerk.“

„Erschaffen“ oder „Stornieren?“

😌

#lostintranslation #swdev #fail #solar #Photovoltaik #tsun

TIL: Running Golang functions in Secrets Mode 🥷
https://antonz.org/accepted/runtime-secret/

"The new runtime/secret package lets you run a function in secret mode. After the function finishes, it immediately erases (zeroes out) the registers and stack it used. Heap allocations made by the function are erased as soon as the garbage collector decides they are no longer reachable.

secret.Do(func() {
// Generate an ephemeral key and
// use it to negotiate the session.
})

This helps make sure sensitive information doesn't stay in memory longer than needed, lowering the risk of attackers getting to it.

The package is experimental and is mainly for developers of cryptographic libraries, not for application developers."

#swdev #appsec #cryptography #defendabledesign

Go feature: Secret mode

Automatically erase memory to prevent secret leaks.

Can anyone spot the difference between these strings?

`"serialNumber":"551cb36993ec4442d83da5f223ee8158dce730f3"`

'"serialNumber":"551CB36993EC4442D83DA5F223EE8158DCE730F3"'

Just spent three hours on this.

Anyone got a good screamin' void recommendation?

#swdev #software

"This wasn't caught in testing because the code was so simple it /obviously/ didn't need testing."

#SwDev