Re: [PATCH] branch: report kind of checkout when rejecting delete
René Scharfe <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
On 7/19/26 12:09 AM, Junio C Hamano wrote: > René Scharfe <[email protected]> writes: > >>>> + int kind = branch_checkout_kind(name); >>> >>> Not "enum branch_checkout_kind" but "int"? >> >> Yes, it doesn't matter for the switch and is easier to print. > > I do not understand the "print" part. I was probably in the last > group of people who was forced to switch from CPP macros to enum > and their argument was always "'print kind' in GDB gives symbolic > output". As "enum" is an glorified "int", wouldn't > > int i_kind; > enum branch_checkout_kind e_kind; > BUG(_("we did not expect %d %d"), e_kind, i_kind); > > do just what we expect? True, integer promotion makes this work regardless of the underlying type of the enum. It was easier for me to make that conversion explicit than to remember the conversion rule. Which isn't that complicated, though, admittedly. René