---
id: 4497
title: "Unaligned accesses in C/C++: what, why and solutions to do it properly"
source_domain: blog.quarkslab.com
source_url: "https://blog.quarkslab.com/unaligned-accesses-in-cc-what-why-and-solutions-to-do-it-properly.html"
published_at: "2018-10-15T22:00:00Z"
tags: ["c", "cpp", "programming", "alignment", "memory", "portability"]
phying_url: "https://phying.com/item/4497"
lang: en
---

# Unaligned accesses in C/C++: what, why and solutions to do it properly

## Summary

Explains why unaligned memory accesses fail on some CPUs (e.g. ARMv5) and how C/C++ alignment rules interact with pointer casts, then offers portable solutions as a small library.

## Intelligence Metadata

- **Sources:** blog.quarkslab.com
- **Published:** 2018-10-15T22:00:00Z
- **Original:** https://blog.quarkslab.com/unaligned-accesses-in-cc-what-why-and-solutions-to-do-it-properly.html
- **Phying News:** https://phying.com/item/4497
