On Wed, Jun 1, 2016 at 10:13 AM, Barret Rhoden <[email protected]> wrote:
> On 2016-05-31 at 17:20 Dan Cross <[email protected]> wrote: > > These are defined in third_party code, but in code that we control, > > replace these with calls to our COUNT_OF macro. > > Thanks. > Ain't no thang. To some extent, we're living on borrowed time with ros/common.h and > similar headers. It's a nice idea to have convenient things for > userspace, like ARRAY_SIZE, but we run into collisions with other > projects who had the same idea who unfortunately didn't use an ifndef. > The end result is that every project ends up defining these things. > > If we ever run into someone using COUNT_OF, then we can revisit this, > like we do with any other header collisions. > Indeed. The issue has been raised that we should strive for commonality between the kernel and userspace with respect to this macro; I can't disagree. Now that we're consistently using COUNT_OF in userspace, we could use 'sed' to change it to something else. I've got a couple of suggestions: // The first comes from plan9; the second is a more stylistically-consistent variation. nelem NELEM // A big project I've worked on calls this `arraysize`, all lower-case, no underscore. arraysize ARRAYSIZE // Another option would be some sort of hybrid: // (Various permutations of capitalization, underscore, order, etc). array_nelem ARRAY_NELEM ARRAYNELEM nelem_array NELEM_ARRAY NELEMARRAY ARRAYSZ arraysz ARRSIZE arrsize // We could switch up ordering: SIZE_ARRAY SIZEARRAY SIZEOF_ARRAY SIZEOFARRAY size_array sizeof_array sizearray sizeofarray // We could use another word instead of 'size': ARRAY_LENGTH array_length ARRAY_LEN array_len ARRAYLENGTH arraylength ARRAYLEN arraylen arrlength Meh. Merged to master at 63c267a4a23f..c658bc5e143c (from, to] > > You can see the entire diff with 'git diff' or at > https://github.com/brho/akaros/compare/63c267a4a23f...c658bc5e143c > > Barret > > -- > You received this message because you are subscribed to the Google Groups > "Akaros" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
