enh(NumberFormatter): Introduce backward compatible options for formatHex functions#4333
enh(NumberFormatter): Introduce backward compatible options for formatHex functions#4333
Conversation
|
@matejk @bas524 apparently, the sendFile pull did not have the VS projects regenerated, so we have CI failures not. That's why I asked for a new pull to trigger build and testrun. anyway, all affected VS projects should be regenerated with progen |
I'll take care first thing in the morning since I messed up. |
820b82c to
4a6366e
Compare
|
@aleks-f, are there any comments from your side on this PR or can I merge to devel? |
35944fe to
b288f6e
Compare
| /// The value is treated as unsigned. | ||
|
|
||
| [[deprecated("use formatHex with options instead")]] | ||
| static std::string formatHex(int value, int width, bool prefix); |
There was a problem hiding this comment.
So why do you remove default prefix false? That change will break things if someone is using these functions. They have been in 11 years already. Surely someone is relaying them. And if we remove those why to depracate these functions even in the first place if user still get broken build.
There was a problem hiding this comment.
I agree - deprecated functions' reason for existence is precisely not to break code and give people time to adjust
There was a problem hiding this comment.
I removed the default prefix because there is ambiguity and compile fails.
[[deprecated("use formatHex with options instead")]]
static std::string formatHex(int value, int width, bool prefix = false);
static std::string formatHex(int value, int width, Options options = Options::OPT_NONE);
Default was no prefix which is also the default when using options. The behaviour for the user if it did not use the prefix does not change. Deprecation warning is issued in cases when bool prefix argument was explicitly used. All situations including defaults are tested with unit tests.
/Users/matejk/git/github/poco/Foundation/src/Logger.cpp:252:18: error: call to 'formatHex' is ambiguous
message.append(NumberFormatter::formatHex(addr, 4));
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/matejk/git/github/poco/Foundation/include/Poco/NumberFormatter.h:704:37: note: candidate function
inline std::string NumberFormatter::formatHex(int value, int width, bool prefix)
^
/Users/matejk/git/github/poco/Foundation/include/Poco/NumberFormatter.h:710:37: note: candidate function
inline std::string NumberFormatter::formatHex(int value, int width, Options options)
^
| /// The value is treated as unsigned. | ||
|
|
||
| [[deprecated("use formatHex with options instead")]] | ||
| static std::string formatHex(int value, int width, bool prefix); |
There was a problem hiding this comment.
I agree - deprecated functions' reason for existence is precisely not to break code and give people time to adjust
ccdc7ec to
208ae0f
Compare
208ae0f to
a127656
Compare
Fixes #3667 and replaces #3657.