-Wformat-diag: floating-point or floating point?
Richard Earnshaw (lists)
Richard.Earnshaw@arm.com
Wed May 22 12:28:00 GMT 2019
On 22/05/2019 13:17, Bill Schmidt wrote:
> On 5/22/19 5:19 AM, Richard Earnshaw (lists) wrote:
>> On 21/05/2019 21:18, Bill Schmidt wrote:
>>> On 5/21/19 11:47 AM, Martin Sebor wrote:
>>>> The GCC coding style says to use "floating-point" as an adjective
>>>> rather than "floating point."Â After enhancing the -Wformat-diag
>>>> checker to detect this I found a bunch of uses of the latter, such
>>>> as in:
>>>>
>>>> Â gcc/c/c-decl.c:10944
>>>> Â gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>>> Â gcc/convert.c:418, 422
>>>> Â gcc/cp/call.c:5070
>>>> Â gcc/cp/cvt.c:886
>>>>
>>>> Before I fix them all and adjust the tests, I want to make sure
>>>> we really want to follow this rule. The C standard uses both
>>>> interchangeably. With just one exception, the C++ standard uses
>>>> the hyphenated form.
>>> The hyphenated form is correct English, so I certainly prefer it. :-)
>>>
>> It's not quite as simple as that. Hyphens should be used to make it
>> clear what is the adjective and what is the noun:
>>
>> A floating-point number (hyphenated) is a number with a
>> floating point (no hyphen).
>>
>> In the first case 'floating-point' is the adjective and qualifies
>> number. In the second case 'floating' is the adjective and qualifies
>> 'point'.
>>
>> But this is English, so there are probably some exceptions even then -
>> but not in this case, I think. :-)
>
> English is always fun, agreed -- Martin cited the requirement to use
> "floating-point" when it's used as an adjective, which is certainly correct.
>
> There's a more interesting question around cavalier usage such as,
> "We should use floating point."Â I would argue that there is an implied
> noun "arithmetic" modified here, so this should also be hyphenated,
> but I daresay there would be people on both sides of this one...
I would argue that leaving out "arithmetic" is the error. :-)
>
> This is why grammar police usually die from friendly fire. :-)
>
Sticking your head above the parapet is always fraught with danger :)
R.
More information about the Gcc
mailing list