Re: [dev] [sic] [patch] const-correctness and formalities

From: FRIGN <dev_AT_frign.de>
Date: Thu, 22 Aug 2013 07:49:05 +0200

>> Declaring immutable arguments makes reading the code easier.
>
> Depends of the eyes, for me, const only adds noise to the code and
> it should be avoid except in some situations. In the case of main
> is directly an error because the standard says explicityly that main
> must be defined as:
>
>
> main() (only in c89)
> int main()
> int main(int argc, char *argv[])
> int main(int argc, char argv[][])
>
> The effects of other definition of main is implementation defined.

Whereas it's debatable for the other functions, I was wrong with main's
arguments. I'll fix the patch.

>
>> Additionally, there was a small formal error how the pointer to the
>> isspace()-function was passed as an argument to the eat-function.
>
> What error? The name of a function generates a pointer to the function, and
> it is the correct way of passing a pointer to function. It is similar
> when you use the name of an array, that generates a pointer to the first
> element of the array.

Reading it up again, the unary & is not necessary, because the
conversion from function to function-pointer is already implicit.
Thanks for pointing that out!

>
>> Please let me know what you think about my proposed changes.
>
> I only like the int -> size_t in strlcpy change.
>

Due to the contentiousness of this topic, I'll fix my code and release a
second version.
Stay tuned!

        FRIGN
Received on Thu Aug 22 2013 - 07:49:05 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 22 2013 - 10:00:03 CEST