Skip to content

println! macro uses printf incorrectly #7

@FreeFull

Description

@FreeFull

Currently, the dos_x::io::println macro directly passes the formatted string as the first parameter to printf. This is wrong, since printf will then interpret any uses of % as conversion specifications.

The code below should output %d to stdout, but instead it currently prints a random number from the stack:

println!("%d");

Instead of printf, the macro should probably call puts(msg) (Which outputs a string as is, and then outputs a newline, so adding the "\n" wouldn't be necessary any more), or call printf("%s", msg);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions