lkml.org 
[lkml]   [2023]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 2/7] platform/x86/intel/ifs: Introduce Array Scan test to IFS
Date
>> +enum test_types {
>> + IFS_SAF,
>> + IFS_ARRAY,
>
> As you are using this enum to index an array, don't you need to set the
> starting value to be sure it's 0?

C standard says: "The value of the first enumerator (if it does not use = constant-expression) is zero."

>> +#define IFS_NUMTESTS ARRAY_SIZE(ifs_devices)
>
> Don't do this, just have a list with a NULL entry at the end, makes
> things much simpler and easier over time.

Maintainers seem to be divided over this. Personally, I'm also
in favor of a NULL entry to mark the last entry (I think it was one
of Kernighan and Plauger's style guides "End markers are better
than counts"). But the tiny footprint folks have beaten me up in
the past for wasting a whole extra structure element just to include
a terminator. :-(

-Tony

\
 
 \ /
  Last update: 2023-03-27 00:26    [W:0.876 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site