Re: [RFC 1/5] Add helper functions check_for_flags and check_for_flags_vqcs

Philippe Waroquiers
2018-05-18T21:42:25Z

On Thu, 2018-05-17 at 21:22 -0400, Simon Marchi wrote:
> > + /* First set the flags_counts to 0. */
> > + {
> > + const char *f = flags;
> > + while (*f)
> > + {
> > + flags_counts[f - flags] = 0;
> > + f++;
> > + }
> > + }
>
> What about something like
>
> memset (flags_count, 0, sizeof (flags_count[0]) * strlen (flags));

The code initialising the flags_counts is somewhat similar in structure
to the code that increments the flags_counts.

So, it looks more clear to me to have the zero-ing code and
the incrementing code looking like each other.

But if for gdb, using memset is the typical pattern to zero
an array of int, fine for me.

What do you think ?

Philippe