Alexander Bluhm <[email protected]> wrote:

> On Thu, Jan 20, 2022 at 07:02:43PM +0000, Miod Vallat wrote:
> > > An unsinged TF_TIMER does not create that problem.
> > 
> > Why don't you simply append an U suffix to TF_TMR_REXMT?
> 
> There are a lot of TF_ flags.  Ususally we dont put an U to hex
> flags.  The only one that is used for shifting is TF_TMR_REXMT after
> going through the TF_TIMER define.  So I thought the cast there is
> most specific.
> 
> Alternatives are:
> - put U to every TF_ TCP flag
> - put U to all TF_TMR_ timer flags
> - put U to TF_TMR_REXMT retransmit timer flag
> - cast TF_TIMER to unsigned (what I did)
> - cast to unsigned in the TCP_TIMER_ARM, TCP_TIMER_ARM_MSEC,
>   TCP_TIMER_DISARM, TCP_TIMER_ISARMED macros where the shift happens.
> 
> There is no best, minimalistic and most consistent solution.

I have always considered numberU as being the same type of thing as
using 'u_int' instead of 'int' for a variable, it is idiomatic C
to force all considerations into signed.

If our system header files had 4000 lines with U, how many bugs
would get fixed incidentaly?

It is a strong idiom.  A sad idiom, perhaps.  It wasn't needed in
historic C, a compiler would always generate the correct code, but
here we are.


Reply via email to