Skip to content

Is a ZST C-variadic parameter equivalent to a non-present parameter? #378

@kupiakos

Description

@kupiakos

Is the following:

unsafe { printf(b"hello %d %d world\n\0".as_ptr().cast(), 10i32, (), 20i32, ()) };

Equivalent to:

unsafe { printf(b"hello %d %d world\n\0".as_ptr().cast(), 10i32, 20i32) };

If the former is allowed, and passing a ZST as a variadic parameter is equivalent to the parameter being non-present, this makes a safe printf wrapper macro I'm writing much simpler while remaining extensible. I can confirm that this compiles and runs as expected on my platform (ZST has no effect), but since I can't find any docs referencing this, I don't want to rely on that behavior without some sort of stability promise 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions