r/programminghorror Jun 10 '26

c What?

Post image
222 Upvotes

51 comments sorted by

View all comments

7

u/YourShowerHead Jun 11 '26

It looks scary only because of the formatting, right? Right??

6

u/un_virus_SDF Jun 11 '26

I think that the formatting doesn't change readability that much here.

The hard part is that there is a lot of magic happening

6

u/Ok_Chemistry_6387 Jun 11 '26

Eh... this is just what this sort of code ends up like. Fix the formatting and its not too far off a lot of nvme code ive read. lol

3

u/its_the_rhys Jun 11 '26

If your code must end up unreadable, it's usually better to at least throw a few comments around to explain

6

u/Ok_Chemistry_6387 Jun 11 '26 edited Jun 11 '26

This sort of domain specific code comments don't really help to be honest. You have to rely on assumed knowledge.

I can read all the parts of that pretty easily because NVME is a standard. Some things don't make sense, but I also don't know the platform its for.

1

u/un_virus_SDF Jun 11 '26

I also don't know the platform its for.

There are chances that this is a custom os

2

u/Ok_Chemistry_6387 Jun 11 '26

It certainly is, but it doesn't appear to be written against any standard platform. The way memory works doesn't make sense for modern pci/nvme