# Static rustc_lint_defs::builtin::BAD_ASM_STYLE

source ·

    pub static BAD_ASM_STYLE: &Lint

Expand description

The `bad_asm_style` lint detects the use of the `.intel_syntax` and `.att_syntax` directives.

#### §Example

ⓘ

    #[cfg(target_arch="x86_64")]
    use std::arch::asm;

    fn main() {
        #[cfg(target_arch="x86_64")]
        unsafe {
            asm!(
                ".att_syntax",
                "movq %{0}, %{0}", in(reg) 0usize
            );
        }
    }

This will produce:

    warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
     --> src/main.rs:8:14
      |
    8 |             ".att_syntax",
      |              ^^^^^^^^^^^
      |
      = note: `#[warn(bad_asm_style)]` on by default

#### §Explanation

On x86, `asm!` uses the intel assembly syntax by default. While this can be switched using assembler directives like `.att_syntax`, using the `att_syntax` option is recommended instead because it will also properly prefix register placeholders with `%` as required by AT&T syntax.