E0060 - Error codes index
Description: Book listing all Rust error codes

## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

# Error code E0060

External C functions are allowed to be variadic. However, a variadic function takes a minimum number of arguments. For example, consider C’s variadic `printf` function:

    #![allow(unused)]
    fn main() {
    use std::os::raw::{c_char, c_int};

    extern "C" {
        fn printf(_: *const c_char, ...) -> c_int;
    }

    unsafe { printf(); } // error!
    }

Using this declaration, it must be called with at least one argument, so simply calling `printf()` is invalid. But the following uses are allowed:

    use std::os::raw::{c_char, c_int};
    #[cfg_attr(all(windows, target_env = "msvc"),
               link(name = "legacy_stdio_definitions",
                    kind = "static", modifiers = "-bundle"))]
    extern "C" { fn printf(_: *const c_char, ...) -> c_int; }
    fn main() {
    unsafe {
        printf(c"test\n".as_ptr());

        printf(c"number = %d\n".as_ptr(), 3);

        printf(c"%d, %d\n".as_ptr(), 10, 5);
    }
    }