---
name: "BUILD_BUG_ON"
section: "9"
platform: "linux"
package: "linux-manual-3.2"
version: "3.2.78-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/BUILD_BUG_ON"
---

# BUILD\_BUG\_ON(9)

break compile if a condition is true.

## NAME

BUILD\_BUG\_ON - break compile if a condition is true.

## SYNOPSIS

**BUILD\_BUG\_ON(***condition***);**

## ARGUMENTS

*condition*

the condition which the compiler should know is false.

## DESCRIPTION

If you have some code which relies on certain constants being equal, or other compile-time-evaluated condition, you should use BUILD\_BUG\_ON to detect if someone changes it.

The implementation uses gcc's reluctance to create a negative array, but gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments to inline functions). So as a fallback we use the optimizer; if it can't prove the condition is false, it will cause a link error on the undefined “\_\_build\_bug\_on\_failed”. This error message can be harder to track down though, hence the two different methods.

## COPYRIGHT
