On Thu, Mar 21, 2013 at 12:49:50PM -0700, Jonathan Nieder wrote:
> > We could also convert the flag to an enum, which would
> > provide a compile-time check on the function input.
>
> Unfortunately C permits out-of-bounds values for enums.
True, although I would think that most compilers take th
Junio C Hamano wrote:
> Jonathan Nieder writes:
>> Jeff King wrote:
>>> + default:
>>> + die("BUG: unhandled change_type %d in
>>> wt_status_print_change_data",
>>> + change_type);
>>
>> Micronit: s/unhandled/invalid/.
>
> I actually think "unhandled" is more correct fo
Jonathan Nieder writes:
> Jeff King wrote:
>
>> Instead of using the "x = x" hack, let's handle the default
>> case in the switch() statement with a die("BUG"). That tells
>> the compiler and any readers of the code exactly what the
>> function's input assumptions are.
>
> Sounds reasonable.
>
>>
Jeff King wrote:
> Instead of using the "x = x" hack, let's handle the default
> case in the switch() statement with a die("BUG"). That tells
> the compiler and any readers of the code exactly what the
> function's input assumptions are.
Sounds reasonable.
> We could also convert the flag to an
In wt_status_print_change_data, we accept a change_type flag
that is meant to be either WT_STATUS_UPDATED or
WT_STATUS_CHANGED. We then switch() on this value to set
the local variable "status" for each case, but do not
provide a fallback "default" label to the switch statement.
As a result, the
5 matches
Mail list logo