Correct KFormat::formatBytes examples
ClosedPublic

Authored by bruns on Jun 16 2018, 4:47 PM.

Details

Summary

The example left out the "precision" parameter, reported values where
wrong (values are rounded, not truncated). The precision parameter is
ignored for values less than 1000 resp. 1024.

Test Plan

make test

Diff Detail

Repository
R244 KCoreAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Jun 16 2018, 4:47 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJun 16 2018, 4:47 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Jun 16 2018, 4:47 PM
apol added a subscriber: apol.Jun 18 2018, 11:22 AM

Then explain why it works? Actually the former behaviour is what I'd expect.

src/lib/util/kformat.h
188

What's "resp."?

bruns marked an inline comment as done.Jun 18 2018, 11:58 AM
bruns added inline comments.
src/lib/util/kformat.h
188

respectively

bruns marked an inline comment as done.Jun 18 2018, 12:01 PM
In D13571#279453, @apol wrote:

Then explain why it works? Actually the former behaviour is what I'd expect.

The given example is just plain wrong. It does not work, it is just some false prosa.

apol added a comment.Jun 18 2018, 2:57 PM

The given example is just plain wrong. It does not work, it is just some false prosa.

Fair enough, yet the API user may want to be able to understand what's the logic behind it, so if it can be explained on the documentation that could be useful.

src/lib/util/kformat.h
188

Please use the full word.

bruns added a comment.Jun 18 2018, 3:36 PM
In D13571#279550, @apol wrote:

The given example is just plain wrong. It does not work, it is just some false prosa.

Fair enough, yet the API user may want to be able to understand what's the logic behind it, so if it can be explained on the documentation that could be useful.

What is "it"?

This patch does not change any behaviour, it just ensures the documentation matches reality.

bruns added inline comments.Jun 18 2018, 3:39 PM
autotests/kformattest.cpp
37

See here for handling of precision for small values. Or read the code in kformatprivate.cpp.

apol added a comment.Jun 19 2018, 2:08 PM
In D13571#279550, @apol wrote:

The given example is just plain wrong. It does not work, it is just some false prosa.

Fair enough, yet the API user may want to be able to understand what's the logic behind it, so if it can be explained on the documentation that could be useful.

What is "it"?

This patch does not change any behaviour, it just ensures the documentation matches reality.

Don't make me read the code. You are updating documentation, the documentation itself needs to offer such information.

bruns added a comment.Jun 19 2018, 7:57 PM
In D13571#280135, @apol wrote:
In D13571#279550, @apol wrote:

The given example is just plain wrong. It does not work, it is just some false prosa.

Fair enough, yet the API user may want to be able to understand what's the logic behind it, so if it can be explained on the documentation that could be useful.

What is "it"?

This patch does not change any behaviour, it just ensures the documentation matches reality.

Don't make me read the code. You are updating documentation, the documentation itself needs to offer such information.

I was referring to you vague formulation "understand what's the logic behind it". Apparently you need some clarification for "something". Why don't you tell what "something" is?

Instead of accepting a documentation *fix*, you are nitpicking about something, but you do not really tell what you don't like.

The example code neither compiles, nor does the output - after fixing the broken code - match the output from the documentation.

bruns updated this revision to Diff 36731.Jun 26 2018, 11:00 PM

Use @code/@endcode
Reword extended documentation for precision parameter

bruns marked 2 inline comments as done.Jul 9 2018, 6:08 PM

ping!

dhaumann accepted this revision.Jul 9 2018, 10:15 PM
dhaumann added a subscriber: dhaumann.

I think this is an improvement. Even if it can be improved even more, I believe it is better to push this instead of postponing a commit.

This revision is now accepted and ready to land.Jul 9 2018, 10:15 PM
This revision was automatically updated to reflect the committed changes.