Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmh, type-casts are evil(TM). Is there any specific reason for this one? It's only to fix the
printk()format, right? The calculation, the value would be exactly the same if we just used%d? Maybe just do that then... Or is this becausesize_tis a different type on 32-bit builds, ARM?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be->max is an int, but after arithmetic with sizeof(), it's a "unsigned int" right. so would "%u" as printf syntax solve ths issue without a cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh yes size_t is different.
I tried earlier with a %d but it wouldn't work for x86_64. the %lu fails on 32-bit.
So I settled on a typecast to force the use of size_t, and let the compiler adjust.
If you have a better solution I am all ears, just trying to avoid an error reported upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kv2019i no, sizeof() returns a size_t, which can be 32 or 64 bits, so that impacts the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cast seems unnecessary,
%zdshould be enough. Have you tried with%zdonly and no cast?I think we can safely assume
size_thas a rank always greater or equal toint.In user space the following code compiles with both
-m32and-m64without any warning:https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because you switch to
%lu(by accident?). I wrote no cast and%zu.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see e1cc344, didn't work.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that e1cc344 has%luand not the%zuthat I suggested.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's %zu alright e1cc344#diff-6782c454986b1c6b9d4916315dd9dec7R391
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I was misled by the error message in topology.c which you hadn't changed yet.