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...