Uh oh!
There was an error while loading. Please reload this page.
Unify lengthof/string_lengthof -like macros - #61537
Conversation
ghost
commented
Nov 12, 2021
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
What are the |
eb0d614 to
1725ec7Compaream11
commented
Nov 13, 2021
There were about 32 definitions of those macros repo-wide, this patch moves the definitions in a single place: runtime/src/native/minipal/utils.h Lines 7 to 10 in ad9e726 |
jkotas
commented
Nov 13, 2021
What is the most common name used for this macro in the universe? Would it look better to standardize on that name without any prefix? |
vargaz
commented
Nov 13, 2021
There is no common name i think, mono uses the name from glib. |
SingleAccretion
commented
Nov 13, 2021
Note that the Jit also uses an |
I don't have strong opinions about the name (naming stuff is hard), so whatever is decided I'm fine with it; now that find & replace after this patch is much easier. ;) Prefix convention (used heavily in mono) helps identifying where the macro or function definitions are coming from. Recently, we prefixed functions with |
Uh oh!
There was an error while loading. Please reload this page.
am11
commented
Nov 22, 2021
Renamed |
vargaz
commented
Nov 22, 2021
That doesn't match the mono coding conventions and looks very much like some kind of compiler intrinsic. |
jkotas
commented
Nov 22, 2021
@vargaz What would be your preferred name? |
vargaz
commented
Nov 22, 2021
Not sure this particular macro needs to be unified between the runtimes, both of them already has their own version. |
jkotas
commented
Nov 22, 2021
I hope that we will share more code between the runtimes over time. I think it is important that we get the details like these unified to something reasonable. Do you have an opinion what should be the name to standardize on in the code shared between runtimes for this one? |
vargaz
commented
Nov 22, 2021
Imho the problem is that the runtimes have different coding conventions, so not sure a macro name can fit both equally well. I'd prefer the traditional uppercase macro naming style. |
src/native/eventpipe is another example of code shared between runtimes, where we have function, as well as the macro names prefixed and macros are upper cased. coreclr uses many different conventions (prefix, no prefix, upper, lower, mixed casing) for macros so there is no problem in changing it to whichever name is suitable. |
jkotas
commented
Nov 22, 2021
Would |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Nov 23, 2021
Based on the feedback, here is my proposal to land this PR:
@am11 If there is no push back in next two days, could you please implement these change? I am sorry about the back and forth, and thank you for your work on various cleanups! |
vargaz
commented
Nov 24, 2021
Sounds good |
src/native/commontosrc/native/minipal_countofand_strcountof._countof,lengthof,NumItems,ARRAY{_}SIZElike macros with_countof.lengthofandStrLenlike macros with_strcountof._countof() - 1patterns to_strcountof()in few places.In second commit, ran editor macro to cleanup trailing whitespaces in files touched by the first commit.