This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: https://gcc.gnu.org/gcc-7/changes.html
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jonny Grant <jg at jguk dot org>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Tue, 11 Jul 2017 17:56:26 +0100
- Subject: Re: https://gcc.gnu.org/gcc-7/changes.html
- Authentication-results: sourceware.org; auth=none
- References: <d6e7c052-38b3-006d-9d14-d232f392e3b2@jguk.org>
On 11 July 2017 at 17:51, Jonny Grant wrote:
> Hello
> https://gcc.gnu.org/gcc-7/changes.html
>
> snprintf (d, sizeof d, "%#02x", x & 0xff);
>
> ^^
> Should be: sizeof(d) ?
"The sizeof operator yields the size (in bytes) of its operand, which
may be an expression or the parenthesized name of a type."
So the parentheses are only required for a type, not an expression.
sizeof(d) is the same as sizeof d which is the same as
sizeof(((((d))))).