---
title: "Off the Path"
url: https://daily.dev/posts/off-the-path-hdds0umvq
source_url: https://thedailywtf.com/articles/off-the-path
type: article
source: "The Daily WTF"
published: 2026-06-29T12:21:02.448Z
updated: 2026-06-29T12:21:20.934Z
tags: ["c++"]
reading_time: 2
upvotes: 2
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Off the Path

**[The Daily WTF](https://daily.dev/sources/thedailywtf)** · 2 min read · 2 upvotes · 0 comments

## Summary

A code horror story about cross-platform file path separator handling in C++. Instead of defining a single preprocessor constant for the path separator, a developer copy-pasted a verbose block of #ifdef logic everywhere paths were assembled — including a redundant ReplaceAll sanitization pass on the entire filename string, likely inside a loop. The pattern was then propagated by multiple developers without refactoring, resulting in code that still occasionally outputs the wrong separator.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://thedailywtf.com/articles/off-the-path>

## Similar posts on daily.dev

- [\[HOWTO\] Using Path.Combine correctly to ensure cross-platform compatibility](https://daily.dev/posts/howto-using-path-combine-correctly-to-ensure-cross-platform-compatibility-rild2yaer) · We Are .NET · 0 upvotes · 0 comments
- [The Destination Dir](https://daily.dev/posts/the-destination-dir-qrscglp6r) · The Daily WTF · 1 upvotes · 0 comments
- [I Once Appeared in The Old New Thing](https://daily.dev/posts/i-once-appeared-in-the-old-new-thing-dxs5gpfs9) · Michael Lynch · 5 upvotes · 0 comments
- [A \_\_FILE\_\_ Macro Which Does Not Contain the Whole Source File Path](https://daily.dev/posts/a-file-macro-which-does-not-contain-the-whole-source-file-path-phx1yhylq) · Jacek Galowicz · 0 upvotes · 0 comments

---

Tags: [#c++](https://daily.dev/tags/c++)

[View this post on daily.dev](https://daily.dev/posts/off-the-path-hdds0umvq)
