On 5/6/24 5:38 AM, Bruno Haible wrote:
>> sc_unsigned_int:
>>         @prohibit=u''_int \
>>         halt='don'\''t use u''_int; instead use unsigned int' \
>>           $(_sc_search_regexp)
> Sounds good to me. My only suggestion is to move the sc_unsigned_long
> rule after the sc_unsigned_int rule.
> 
>> The u_char/u_long/u_short/u_int idiom used to be common but today I
>> don't think any reasonable code should use it.
>
> I agree. For some time, Linux kernel headers used these types heavily,
> IIRC. But nowadays, they are nearly gone there as well.

I was trying to get rid of all of the old BSD types from Inetutils.
They seem somewhat portable, but since they are not standardized who
knows how many more years until they cause breakage. :)

Maybe it would be best to have a list of types to prohibit and then
construct a regular expression? Something like the headers we suggest
changing #include "..." to #include <...>.

You would lose the suggested alternative (without doing extra work),
but you could configure the types as you wish without creating
multiple rules.

Off of the top of my head here are some old types that I can think of
that should generally be avoided, but exist in some old code:

     # BSD
     u_char, u_int, etc.
     u_int8_t, u_int16_t, etc.
     quad_t, u_quad_t
     qaddr_t
     # SysV maybe?
     ushort, ulong
     # Mach or BSD, both? Not sure.
     caddr_t, daddr_t

I think the *addr_t types were because prestandard C didn't do
implicit void conversions or something.

Collin

Reply via email to