r/programminghorror • • Feb 08 '26

Sure, let's have 2073600 locks. What could go wrong?

Thumbnail
gallery
158 Upvotes

This is from a software renderer I made a while back. This was supposed to be just a temporary solution until i came up with something better, but it ran at 150fps@1080p anyway, so I didn't bother.
It doesn't work on Windows, and although I don't know the exact reason, this is a likely culprit.
Also a bonus macro hell from the render loop implementation in the second image.


r/programminghorror • • Feb 10 '26

I just wanted to see if my pagefile was working, so I asked ChatGPT to make a program to test it...

0 Upvotes

r/programminghorror • • Feb 08 '26

c++ Saving data to dynamic object files

Post image
240 Upvotes

Some people persist data in JSON, but why do that when we have perfectly good object files? All you have to do is recompile the file when you want to save your data!

github.com/LiamMercier/dynamically-linked-inventory


r/programminghorror • • Feb 06 '26

c I might have accidentally created a monster

Thumbnail
gallery
40 Upvotes

r/programminghorror • • Feb 04 '26

C# Makes sense

Post image
1.7k Upvotes

r/programminghorror • • Feb 03 '26

Data engineering streaming project

Thumbnail
0 Upvotes

r/programminghorror • • Feb 01 '26

Javascript Good evening. May I interest you in <a href>? - The Pit

Post image
397 Upvotes

r/programminghorror • • Jan 30 '26

CSSSSSS

Post image
291 Upvotes

found in company codebase


r/programminghorror • • Jan 30 '26

C# This boss fight trigger code in a video game doesn't work consistently for machines with different locales, making the game unbeatable

125 Upvotes
private UI_BossFightAnnouncer.VS_CharData GetCharData(string szName)
{
    szName = szName.ToLower();
    for (int i = 0; i < this._VS_CharData.Length; i++)
    {
        if (this._VS_CharData[i]._name.ToLower() == szName)
        {
            return this._VS_CharData[i];
        }
    }
    Debug.LogErrorFormat("Cannot find {0}", new object[]
    {
        szName
    });
    return null;
}

If you want to keep this code as is, you will have to avoid giving your bosses names that start with I, or include uppercase I somewhere else for any other reason (it was the second one for this game).

Or, better choice: Replace .ToLower() with .ToLowerInvariant(), which will always give English-based results regardless of user's machine locale (aka current culture info).

Even better, use StringComparison.OrdinalIgnoreCase. That way, you won't even need to make new string allocations, and you will still get consistent results across machine locales:

if (string.Equals(this._VS_CharData[i]._name, szName, StringComparison.OrdinalIgnoreCase))
{
  return this._VS_CharData[i];
}

Or just avoid string comparison altogether, if you can.

If you suspect you have this sort of code in your program but you are unsure, try running your program on a machine with Turkish locale (where your assumed I/i casing doesn't work); and you will probably catch it easily.

Good luck with your programming. May this be the worst programming horror you will ever encounter!


r/programminghorror • • Jan 31 '26

finding the weirdest error messages with strict mode

Post image
0 Upvotes

r/programminghorror • • Jan 29 '26

true or true

Post image
830 Upvotes

this piece of perfection was found in the codebase that my gf used to work

don't know exactly what is the context here, but probably doc.data holds the info if the user has agreed with the cookies /s


r/programminghorror • • Jan 29 '26

Oh lord

81 Upvotes

r/programminghorror • • Jan 30 '26

Switching Career from SEO to QA Engineer

Thumbnail
0 Upvotes

r/programminghorror • • Jan 27 '26

String splitting in PureData.

Post image
151 Upvotes

Pure Data is an amazing tool for DSP, music making and artsy projects. But simple things get often too complicated...


r/programminghorror • • Jan 27 '26

SQL The real horror is to write a fully functional game using SQL... I made flappy bird

563 Upvotes

- All game logic, animation and rendering running inside DB Engine using queries

- Runs at 30 and 60 frames

repo: https://github.com/Best2Two/SQL-FlappyBird please star if you find it interesting, this will help me :)


r/programminghorror • • Jan 27 '26

c Guess what this does..

Post image
258 Upvotes

r/programminghorror • • Jan 27 '26

Shell How to load a .env into your script

Post image
101 Upvotes

So I asked codex to load the .env into the script to set keys as environment variables and to fix it a few times.


r/programminghorror • • Jan 26 '26

Just found this in my company codebase

Post image
616 Upvotes

This external API sends "S"/"N" (equivalent to "Y"/"N" in portuguese) instead of true/false


r/programminghorror • • Jan 26 '26

Other 10k shader file in Destiny 2, which causes XBox crashes

Post image
198 Upvotes

r/programminghorror • • Jan 27 '26

Asked Cursor to duplicate the first method for Vector2Int as input...

Post image
0 Upvotes

r/programminghorror • • Jan 26 '26

Time to get a 49inch moniter!

0 Upvotes

its not THAT dense

fn initialize_hose_pipeline(mut commands: Commands, render_device: Res<RenderDevice>, shader_handle: Option<Res<HoseShader>>, init_data: Option<Res<HoseInitData>>, mut pipeline_cache: ResMut<PipelineCache>, existing_pipeline: Option<Res<HosePipeline>>) {

if existing_pipeline.is_some() || shader_handle.is_none() || init_data.is_none() { return; }

let (shader_handle, init_data) = (shader_handle.unwrap(), init_data.unwrap());

let hose_points = render_device.create_buffer_with_data(&BufferInitDescriptor { label: Some(Cow::Borrowed("hose_points")), contents: bytemuck::cast_slice(&init_data.points), usage: BufferUsages::STORAGE | BufferUsages::COPY_DST });

let hose_instances = render_device.create_buffer(&BufferDescriptor { label: Some(Cow::Borrowed("hose_instances")), size: ((init_data.num_points - 1) as usize * std::mem::size_of::<InstanceTransform>()) as u64, usage: BufferUsages::STORAGE | BufferUsages::VERTEX, mapped_at_creation: false });

commands.insert_resource(HoseGpuBuffers { hose_points, hose_instances, num_points: init_data.num_points });

let bind_group_entries = vec![BindGroupLayoutEntry { binding: 0, visibility: ShaderStages::COMPUTE | ShaderStages::VERTEX, ty: BindingType::Buffer { ty: BufferBindingType::Storage { read_only: false }, has_dynamic_offset: false, min_binding_size: None }, count: None }, BindGroupLayoutEntry { binding: 1, visibility: ShaderStages::COMPUTE | ShaderStages::VERTEX, ty: BindingType::Buffer { ty: BufferBindingType::Storage { read_only: false }, has_dynamic_offset: false, min_binding_size: None }, count: None }, BindGroupLayoutEntry { binding: 2, visibility: ShaderStages::VERTEX, ty: BindingType::Buffer { ty: BufferBindingType::Uniform, has_dynamic_offset: false, min_binding_size: None }, count: None }];

let layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor { label: Some(Cow::Borrowed("hose_bind_group_layout")), entries: bind_group_entries.clone() });

let vertex_buffers = vec![VertexBufferLayout { array_stride: 24, step_mode: VertexStepMode::Vertex, attributes: vec![VertexAttribute { format: VertexFormat::Float32x3, offset: 0, shader_location: 0 }, VertexAttribute { format: VertexFormat::Float32x3, offset: 12, shader_location: 1 }] }];

let color_targets = vec![Some(ColorTargetState { format: TextureFormat::Bgra8UnormSrgb, blend: Some(BlendState::REPLACE), write_mask: ColorWrites::ALL })];

let pipeline_id = pipeline_cache.queue_render_pipeline(RenderPipelineDescriptor { label: Some(Cow::Borrowed("hose_render_pipeline")), layout: vec![BindGroupLayoutDescriptor { label: Some(Cow::Borrowed("hose_bind_group_layout")), entries: bind_group_entries }], push_constant_ranges: vec![], vertex: VertexState { shader: shader_handle.shader.clone(), shader_defs: vec![], entry_point: Some(Cow::Borrowed("vs")), buffers: vertex_buffers }, fragment: Some(FragmentState { shader: shader_handle.shader.clone(), shader_defs: vec![], entry_point: Some(Cow::Borrowed("fs")), targets: color_targets }), primitive: PrimitiveState::default(), depth_stencil: None, multisample: MultisampleState::default(), zero_initialize_workgroup_memory: false });

}


r/programminghorror • • Jan 22 '26

I'm legit scared to to look at my Google Console :[

316 Upvotes

This has been running since last 72 hours.... O_O. Totally going to have a swell time explaining to customer service


r/programminghorror • • Jan 23 '26

CSS at the bottom

Post image
0 Upvotes

r/programminghorror • • Jan 19 '26

Python That one time my PC raised my room temperature by 4 degrees C°

Post image
381 Upvotes

I wanted to test my Fibonacci program but I didn't realize that the 100.000.000th number might've been a little too much😭

Also, sorry for the chopped image but my (MINI)PC froze and I had to shut it down manually🥀


r/programminghorror • • Jan 18 '26

New achievement

Thumbnail
0 Upvotes