Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [patch] give gpioctl.c some love



Am 22.08.15 um 11:20 schrieb Felix Deichmann:
> Am 22.08.2015 um 10:15 schrieb Marc Balmer:
>> Imo, this patch does not solve a problem, but creates new ones, maybe...
>>   The constness that you sprinkle is definitely not needed, only makes
>> the code cluttered imo.
> 
> This "constness" is mainly adding "pointers to const" in function
> arguments and for strings. Some will consider this good style to say the
> least (MISRA, CERT C Coding Standard), and some even claim it will allow
> for better compiler optimization.

I agree for libraries, but not for tools where such functions are only
used internally.  And only that some committees consider sth good style
does not mandate that I use it.

The code is perfectly valid as is and there is no need for such changes.

> 
> CERT has for example:
> DCL00-C. Const-qualify immutable objects
> DCL13-C. Declare function parameters that are pointers to values not
> changed by the function as const
> STR05-C. Use pointers to const when referring to string literals
> STR30-C. Do not attempt to modify string literals
> etc.
> 
> Regards,
> Felix



Home | Main Index | Thread Index | Old Index