---
title: "Convenience Gone Wrong: A C++ auto Story"
url: https://daily.dev/posts/convenience-gone-wrong-a-c-auto-story-lsspswk7i
source_url: https://embeddedartistry.com/blog/2026/02/20/convenience-gone-wrong-a-c-auto-story
type: article
source: "Embedded Artistry"
published: 2026-05-31T07:47:32.359Z
updated: 2026-05-31T08:50:59.357Z
tags: ["c++", "embedded"]
reading_time: 2
upvotes: 0
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.

# Convenience Gone Wrong: A C++ auto Story

**[Embedded Artistry](https://daily.dev/sources/embedded-artistry)** · 2 min read · 0 upvotes · 0 comments

## Summary

A developer shares a debugging war story where a missing `&` on a C++ `auto` variable declaration caused hours of confusion. Using `auto cal = inst.calibration` silently created a local copy of a struct instead of a reference, meaning calibration data written into it was lost when the function returned. The fix was trivial — changing to `auto&` — but the bug was insidious because the code looked correct, the hardware traffic was identical, and the compiler gave no warning. The post reflects on how reaching for convenience via `auto` can introduce subtle, hard-to-spot bugs, and how explicit type declarations might have caught the mistake immediately.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://embeddedartistry.com/blog/2026/02/20/convenience-gone-wrong-a-c-auto-story>

## Similar posts on daily.dev

- [Efficient C\+\+: The hidden compile-time cost of auto return types](https://daily.dev/posts/efficient-c-the-hidden-compile-time-cost-of-auto-return-types-rdhqlnhwk) · Andreas Fertig · 3 upvotes · 1 comments
- [auto\{x\} \!= auto\(x\)](https://daily.dev/posts/auto-x-auto-x--kgzpmhoq1) · Arthur O'Dwyer · 18 upvotes · 0 comments
- [C\+\+20s concepts with a forward declared type](https://daily.dev/posts/c-20s-concepts-with-a-forward-declared-type-yk8qiobn4) · Andreas Fertig · 3 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/convenience-gone-wrong-a-c-auto-story-lsspswk7i)
