This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| // Example implementation for exposition | |
| std::string wchar_to_narrow(const std::wstring& wstr) { | |
| std::mbstate_t state = std::mbstate_t(); | |
| const wchar_t* pWstr = wstr.data(); | |
| std::size_t len = std::wcsrtombs(nullptr, &pWstr, 0, &state); | |
| std::string buf; | |
| buf.resize(len); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| struct HelloData { | |
| int i = 0; | |
| const char* s = ""; | |
| }; | |
| struct CallbackBase { | |
| virtual ~CallbackBase() = default; | |
| virtual void Hello(HelloData const& d) = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define WIN32_LEAN_AND_MEAN 1 | |
| #include <windows.h> | |
| #include <TlHelp32.h> | |
| #include <iostream> | |
| #include <iomanip> | |
| #include <string> | |
| #include <sstream> | |
| int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <string> | |
| __declspec(noinline) double get_delta(double lhs, double rhs) { | |
| return lhs - rhs; | |
| } | |
| void print_dbl(std::string const& what, double val) { | |
| const int dig14 = DBL_DIG - 1; | |
| printf("'%s'@%d: %.*e\n", what.c_str(), dig14, dig14, val); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-NeedsArgvQuote { | |
| <# | |
| .DESCRIPTION Fix up our argument string for the insane CommandLineToArgvW rules | |
| .LINK https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way | |
| #> | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Position=0,Mandatory=1)][AllowEmptyString()][string]$arg | |
| ) | |
| if ([System.String]::IsNullOrEmpty($arg)) { |