# Using Compiler Flags to Secure Your Code

DevFeed: [Using Compiler Flags to Secure Your Code](<https://devfeed.tech/articles/using-compiler-flags-to-secure-your-code-13310.md>)

Original publisher: [Read original article](<https://www.chainguard.dev/unchained/using-compiler-flags-to-secure-your-code>)

Published: 2025-01-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [Chainguard: Unchained](<https://devfeed.tech/sources/chainguard-unchained.md>)

Topics: [Compiler](<https://devfeed.tech/topics/compiler.md>), [Code](<https://devfeed.tech/topics/code.md>), [Memory Safety](<https://devfeed.tech/topics/memory-safety.md>), [Security](<https://devfeed.tech/topics/security.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [gcc](<https://devfeed.tech/topics/gcc.md>), [Dockerfile](<https://devfeed.tech/topics/dockerfile.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [chainguard-images](<https://devfeed.tech/tags/chainguard-images.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compiler-flags](<https://devfeed.tech/tags/compiler-flags.md>), [container](<https://devfeed.tech/tags/container.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [memory-safety](<https://devfeed.tech/tags/memory-safety.md>), [open-ssf](<https://devfeed.tech/tags/open-ssf.md>), [security](<https://devfeed.tech/tags/security.md>)

## AI overview

This tutorial examines OpenSSF-recommended compiler flags for C and C++ code, focusing on how hardened standard-library calls and related protections affect memory safety and buffer-overflow behavior. It demonstrates the examples using a Docker-based development environment.

## Source excerpt

Open SSF's recommended compiler flags are a great way to improve memory safety and security. Check out what effect using these flags can have.