-
Notifications
You must be signed in to change notification settings - Fork 776
Closed
Labels
bugSomething isn't workingSomething isn't workingos winWindows emulation relatedWindows emulation related
Description
*Describe the bug
The implementation of printf/wprintf has incorrect behavior when used for windows.
see documentation here:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170
If I have time in the next few weeks, I'll submit a pr :)
Sample Code
#include <windows.h>
#include <stdio.h>
# define W
int main(){
// https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170
// The windows implementation of printf/wprintf
// type field characters does not confirm to ISO C stanards
// In particular, the behavior of %s/%S is differnt depending on
// on wether printf/wprintf is called
#ifdef W
wprintf(L"I am a C string %s\n", "hello world!");
wprintf(L"I amd a Wide C string %s\n", L"hello world!");
#else
printf("I am a C string %s\n", "hello world!");
printf("I amd a Wide C string %S\n", L"hello world!");
#endif
} x86_64-w64-mingw32-gcc windows_printf.c -DW -o wprintf.exe
x86_64-w64-mingw32-gcc windows_printf.c -o printf.exeExpected behavior
wine64 wprintf.exe
I am a C string hello world!
I amd a Wide C string h
wine64 printf.exe
I am a C string hello world!
I amd a Wide C string hello world!
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingos winWindows emulation relatedWindows emulation related