Skip to content

Functions printf() and strformat() fail when printing "%%" #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Daniel-Cortez opened this issue Mar 14, 2021 · 2 comments
Open

Functions printf() and strformat() fail when printing "%%" #641

Daniel-Cortez opened this issue Mar 14, 2021 · 2 comments

Comments

@Daniel-Cortez
Copy link
Contributor

Issue description:

(The bug described in this issue belongs to the interpreter from this repository (pawnruns), not SA-MP; also, if I understand it correctly, open.mp is also going to use the implementations of format() and printf() from this repo, so I believe this bug report belongs here.)

Printing the percent sign through format specifier %% causes a runtime error.

Minimal complete verifiable example (MCVE):

#include <console>
main()
{
    printf("100%%\n");
}

Output:

100%
Run time error 10: "Native function failed"

Printing % through the %c specifier doesn't cause any errors though:

printf("100%c\n", '%');
100%

Discovered this bug while doing one of the tests for #640.

Workspace Information:

  • Compiler version:
  • Command line arguments provided (or sampctl version):
  • Operating System:
@Y-Less
Copy link
Member

Y-Less commented May 2, 2021

That's interesting... We've got a modified version of format/printf in open.mp, but since it didn't touch %% I'll check there. Thanks.

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the state: stale label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants