frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

I once appeared in The Old New Thing

https://mtlynch.io/my-old-new-thing-cameo/
28•mtlynch•3d ago

Comments

mtlynch•3d ago
Author here. Happy to take any feedback or questions about this post.
quuxplusone•3d ago
At one point you say "precompiler" when I guess you mean "preprocessor"?

Also I think the C preprocessor would be relatively unhelpful with the file format you explained in the post: As soon as you reached the first unmatched, unquoted apostrophe, cpp would assume it was inside a really long character literal and refuse to substitute any macros until the next apostrophe.

cpp is great, but it does basically require a grammar that assigns broadly the expected meaning to ' " # // /* */. Curly-brace languages fine, running English text not so much.

quuxplusone•3d ago
Without running a preprocessor on the .mc file, and without adding "%d" support to `ShowError`, here's one other category of solution. These days, you could just write

    if (minimumPassphraseLength > MAX_PASSPHRASE_MINIMUM) {
      static_assert(MAX_PASSPHRASE_MINIMUM == 20);
      ShowError(ERROR_BITLOCKER_PASSPHRASE_MINIMUM_LONGER_THAN_20);
    }
so that if the value of MAX_PASSPHRASE_MINIMUM ever changed, you'd get a build failure right on this line and you'd be forced to fix it (part of which should involve updating the message to match).

You could make that fancier by trying to craft the name of the error message itself via the preprocessor — something like:

    SymbolicName=ERROR_BITLOCKER_PASSPHRASE_MINIMUM_LONGER_THAN_20
    The BitLocker minimum passphrase length cannot exceed 20.

    ...

    #define CONCAT(x, y) x##y
    #define ERROR_BITLOCKER_PASSPHRASE_MINIMUM_LONGER_THAN(x) \
        CONCAT(ERROR_BITLOCKER_PASSPHRASE_MINIMUM_LONGER_THAN_, x)
    #define MAX_PASSPHRASE_MINIMUM 20

    if (minimumPassphraseLength > MAX_PASSPHRASE_MINIMUM) {
      ShowError(ERROR_BITLOCKER_PASSPHRASE_MINIMUM_LONGER_THAN(MAX_PASSPHRASE_MINIMUM));
    }
But that would just make the compiler error (when MAX_PASSPHRASE_MINIMUM changed) a lot harder to read, without changing the essential task (go find the error message and update it), so it's not a good idea.
mtlynch•3d ago
>At one point you say "precompiler" when I guess you mean "preprocessor"?

Ah, you're right! Fixed, thanks!

>Also I think the C preprocessor would be relatively unhelpful with the file format you explained in the post: As soon as you reached the first unmatched, unquoted apostrophe, cpp would assume it was inside a really long character literal and refuse to substitute any macros until the next apostrophe.

Oh, that's a good point. I'm not sure how Visual C++ does with it, but I just tried with gcc, and it falls over on an apostrophe:

    $ cat values.h 
    #define MAX_PASSPHRASE_MINIMUM 20

    $ cat example.mcp 
    SymbolicName=ERROR_BITLOCKER_PASSPHRASE_MINIMUM_TOO_LONG
    The BitLocker minimum passphrase length can't exceed MAX_PASSPHRASE_MINIMUM.

    $ gcc --version | head -n 1
    gcc (GCC) 14.3.0

    $ gcc --preprocess --language=c --no-line-commands --include=values.h example.mcp
    SymbolicName=ERROR_BITLOCKER_PASSPHRASE_MINIMUM_TOO_LONG
    example.mcp:2:44: warning: missing terminating ' character
        2 | The BitLocker minimum passphrase length can't exceed MAX_PASSPHRASE_MINIMUM.
          |                                            ^
    The BitLocker minimum passphrase length can't exceed MAX_PASSPHRASE_MINIMUM.
card_zero•2h ago
Somehow, for me, your code samples are appearing as black text on a black background.
chihuahua•1h ago
It's kinda mind-boggling to me that after making a change to the build definition, there was no way to try it out and see if it works, other than committing the change and waiting until the next day to see if it broke the build.

My question is: how was anyone expected to make changes to the build definition if this was the only way? Wait a day to find out if it worked, and break the build for everyone if not?

rincebrain•42m ago
My understanding from other anecdotes about Microsoft is that a lot of their internal tooling, for a very long time, remained the kind of hideous nightmare of interwoven dependencies and build times measured in hours that we try to avoid in most modern setups.

I would speculate that in most parts of the company that haven't been left to rot that's hopefully no longer true, but I have no direct anecdotes about that, I just would have assumed it to be a target for someone looking for their iteration cycles to be saner at some point, and once one group managed it, etc.

charcircuit•3h ago
How was this supposebit locker? Every time an admin changed the group policy it would trigger a recompile of bitlocker?
charcircuit•1h ago
Supposed to work.
justusthane•45m ago
I believe that the article is referring to a maximum which is hardcoded into Bitlocker (not user configurable). If the administrator configures via GPO a minimum key length which is longer than the hardcoded maximum, then it spits out the error in question.
wild_pointer•2h ago
Very knowledgeable, helpful, and snarky - that's the vibe I'm getting from Raymond Chen too after reading many of his blog posts.
kevin_thibedeau•2h ago
Everybody in gettext land uses (s)printf format specifiers. Nobody thought to do that at MS?
m0llusk•1h ago
In a way this is more like Perl's maketext or maybe Mozilla Fluent. Reasonable translations need to be constructed using variable inputs and correct messages can vary greatly between languages with grammar agreement and such. While gettext does have some extra support for getting numeric translations and agreements right it is kind of hacked in as an add on to a text lookup procedure rather than in terms of constructing the messages based on inputs.
Arnavion•1h ago
The ShowError() API they're talking about doesn't take a format string. It takes a resource ID which is an integer that's essentially an index in the resource table. So running the message compiler produces a C header that defines ERROR_BITLOCKER_PASSPHRASE_MINIMUM_TOO_LONG to an integer constant, and then ShowError(ERROR_BITLOCKER_PASSPHRASE_MINIMUM_TOO_LONG) looks up the string at that index in the resource table and displays it.

https://learn.microsoft.com/en-us/windows/win32/eventlog/mes...

(You'll note that that page mentions that FormatMessage() does support printf-style format specifiers in the string resource. That's why I'm saying that their ShowError() specifically is the one that doesn't.)

arcfour•1h ago
The Microsoft way is to do things backwards, make the possible impossible, and wrap simple, well-understood APIs behind 16 layers of abstraction with awful names that will ever so slightly munge your arguments. Surely you know this :-)
jenadine•45m ago
A product I was working on had a configuration file that was a bit like a limited programming language.

"One customer" asked me to add some compile time condition based on the platform.

I told him to use the C++ preprocessor and use #if/#ifdef

$2 WeAct Display FS adds a 0.96-inch USB information display to your computer

https://www.cnx-software.com/2025/09/18/2-weact-display-fs-adds-a-0-96-inch-usb-information-displ...
201•smartmic•6h ago•94 comments

Ultrasonic Chef's Knife

https://seattleultrasonics.com/
450•hemloc_io•11h ago•366 comments

The bloat of edge-case first libraries

https://43081j.com/2025/09/bloat-of-edge-case-libraries
8•PaulHoule•1h ago•6 comments

Hyperion: Minecraft game engine for custom events

https://hyperion.rs/
41•cjcuddy•4d ago•8 comments

Teen suspect surrenders in 2023 Las Vegas casino cyberattack case

https://www.casino.org/news/teen-suspect-surrenders-in-2023-las-vegas-strip-cyberattack-case/
41•campuscodi•4h ago•15 comments

Designing NotebookLM

https://jasonspielman.com/notebooklm
177•vinhnx•10h ago•66 comments

Why, as a responsible adult, SimCity 2000 hits differently

https://arstechnica.com/gaming/2025/09/thirty-years-later-simcity-2000-hasnt-changed-but-i-have/
29•doppp•2d ago•16 comments

A brief history of threads and threading

https://eclecticlight.co/2025/09/20/a-brief-history-of-threads-and-threading/
53•emschwartz•6h ago•9 comments

Knitted Anatomy

https://www.knitted-anatomy.at/cardiovascular-system/
73•blikstiender•3d ago•5 comments

I’m Not a Robot

https://neal.fun/not-a-robot/
351•meetpateltech•4d ago•182 comments

Teardown of Apple 40W dynamic power adapter with 60W max

https://www.chargerlab.com/teardown-of-apple-40w-dynamic-power-adapter-with-60w-max-a3365/
112•givinguflac•2d ago•82 comments

Amazon to end commingling after years of complaints from brands and sellers

https://www.modernretail.co/operations/amazon-to-end-commingling-program-after-years-of-complaint...
98•blindriver•1h ago•22 comments

Learning Languages with the Help of Algorithms

https://www.johndcook.com/blog/2025/09/17/learning-languages-with-the-help-of-algorithms/
5•ibobev•3d ago•1 comments

A revolution in English bell ringing

https://harpers.org/archive/2025/10/a-change-of-tune-veronique-greenwood-bell-ringing/
57•ascertain•7h ago•23 comments

Were RNNs all we needed? A GPU programming perspective

https://dhruvmsheth.github.io/projects/gpu_pogramming_curnn/
31•omegablues•2d ago•6 comments

In defence of swap: common misconceptions

https://chrisdown.name/2018/01/02/in-defence-of-swap.html
16•jitl•3h ago•1 comments

Scream cipher

https://sethmlarson.dev/scream-cipher
252•alexmolas•2d ago•94 comments

Solving a wooden puzzle using Haskell

https://glocq.github.io/en/blog/20250428/
55•Bogdanp•3d ago•18 comments

FLX1s phone is launched

https://furilabs.com/flx1s-is-launched/
185•slau•16h ago•142 comments

Escapee pregnancy test frogs colonised Wales for 50 years (2019)

https://www.bbc.com/news/uk-wales-44886585
111•Luc•4d ago•47 comments

Vapor chamber tech keeps iPhone 17 Pro cool

https://spectrum.ieee.org/iphone-17-pro-vapor-chamber
101•rbanffy•13h ago•213 comments

MapSCII – World map in terminal

https://github.com/rastapasta/mapscii
148•_august•2d ago•19 comments

Images over DNS

https://dgl.cx/2025/09/images-over-dns
162•dgl•15h ago•45 comments

After Babel Fish: The promise of cheap translations at the speed of the Web

https://hedgehogreview.com/issues/lessons-of-babel/articles/after-babel-fish
44•miqkt•2d ago•10 comments

Bazel and Glibc Versions

https://blogsystem5.substack.com/p/glibc-versions-bazel
14•goranmoomin•5h ago•25 comments

Why do some gamers invert their controls?

https://www.theguardian.com/games/2025/sep/18/why-do-some-gamers-invert-their-controls-scientists...
69•zdw•6h ago•109 comments

PYREX vs. pyrex: What's the difference?

https://www.corning.com/worldwide/en/products/life-sciences/resources/stories/in-the-field/pyrex-...
123•lisper•21h ago•96 comments

Radar and Radio Failures at Dallas Area Airports

8•pdonner•1h ago•5 comments

Evals in 2025: going beyond simple benchmarks to build models people can use

https://github.com/huggingface/evaluation-guidebook/blob/main/yearly_dives/2025-evaluations-for-u...
61•jxmorris12•2d ago•6 comments

Cormac McCarthy's tips on how to write a science paper (2019) [pdf]

https://gwern.net/doc/science/2019-savage.pdf
201•surprisetalk•13h ago•80 comments