This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FYI: Small build fix for unusual configuration


Hi Petr,

> This might be just shifting the problem into the future, but this
> works with less code and will make it easier to add more formats,
> should that be necessary:
> 
> >      for (size_t i = 0;
> >- i < sizeof vmlinux_suffixes / sizeof vmlinux_suffixes[0];
> >+ i + 1 < (sizeof vmlinux_suffixes / sizeof vmlinux_suffixes[0]) + 1;

Yeah, Frank did point out that if you make the code less specific
and mark i as int, then the compiler also isn't smart enough to
notice that the comparison is always true when the array is empty.

Feel free to replace my solution with something simpler if you think
that is more clear. My fix might have been a tad too "pedantically
correct".

Thanks,

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]