This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: Use const_bitmap in GCC sources



I think one might rightfully expect that this query-type function
doesn't modify its arguments and it could have it's bitmap constified.
But it turns out that it calls bitmap_find_bit() which is documented
to modify the supplied bitmap.  So I left bitmap_bit_p() as non-const,
but IMHO, this is a misleading API uncovered through my audit.  At
least now that everything else in this module is constified, it
becomes more obvious to the caller that the supplied parameter may be
changed.

bitmap_find_bit maintains a cache, and this is what "mutable" is used for in C++. I think you can rightfully cast away the "const" in bitmap_find_bit, i.e. add const_bitmap even in bitmap_find_bit.


Paolo


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