gcc warns for memmove (0, b, 0)

Jonathan Wakely jwakely.gcc@gmail.com
Wed Nov 16 12:22:00 GMT 2016


On 16 November 2016 at 12:01, Andrew Haley wrote:
> On 16/11/16 11:45, Prathamesh Kulkarni wrote:
>> I am not sure though how to interpret this in context of above example.
>
> This is for GCC help, not general help with C.
>
> However,
>
> ISO/IEC 9899:2011
>
> 7.24.1 String function conventions
>
> Where an argument declared as size_t n specifies the length of the
> array for a function, n can have the value zero on a call to that
> function. Unless explicitly stated otherwise in the description of a
> particular function in this subclause, pointer arguments on such a
> call shall still have valid values, as described in 7.1.4.
>

See also "Null pointer checks may be optimized away more aggressively"
at https://gcc.gnu.org/gcc-4.9/porting_to.html



More information about the Gcc-help mailing list