Keith Thompson said:
That covers more ground than I attribute to "implicit cast". If
we use "conversion" for both sets of cases, often it will be hard
to tell which sense of "conversion" is meant.
How is that distinction useful,
Here is a list (probably partial) of conversions that are done
without needing a cast operator:
lvalue to value
array to pointer-to-first-element
function to pointer-to-function (plus implied * when calling)
RHS value on assignment to LHS type (usual cases, see below)
argument to parameter (for prototyped functions)
argument to parameter (for non-prototyped functions)
return expressions to function result type
promotion of integer operands to 'int' or greater
usual arithmetic conversions
some special cases (eg, ?:, some cases of assignment)
controlling expressions in 'if', etc.
To me, only some of these cases fall under the heading of "implicit
cast". For example, the lvalue-to-value conversion: there isn't even
any way of /writing/ this conversion using a cast operator -- hence I
wouldn't expect it to be included if someone said "implicit cast".
To answer your question more directly, I think it's useful in
"chunking" the different kinds of "invisible" conversions that C has,
and in talking about those conversions, to have a short convenient
phrase that is limited to "assignment-like" cases: namely, certainly
assignment and argument-to-parameter for prototyped functions, and
return expressions, and controlling expressions; maybe also integer
promotions and argument-to-parameter for non-prototyped functions;
almost certainly not lvalue-to-value, array to pointer, or function to
function pointer; probably not the usual arithmetic conversions; and
I'll just say unsure on the others. I believe there's a natural
division of the different kinds of "invisible" conversions that C
supplies, both as beginners understand C and as (some) more expert
C'ers understand C, and it's useful to identify one subset or the
other. The dividing line may not be sharply defined, but it's
still useful to be able to distinguish the two sides easily. A
phrase like "implicit cast" (or perhaps another phrase) could do
that.
and how do you know that the previous
poster intended to make that distinction?
I don't know, specifically, which distinction may have been
intended, or indeed if there was any conscious thought on
the matter. However, reading over what was said, I believe
that not all cases of "invisible" conversions would fall
under the "implicit cast" label. For example, assigning an
int to an int, the RHS (which is an int) is converted to int
(the type of the LHS); there is an "invisible" conversion,
but I expect very few people (even those who don't mind the
phrase generally) would say there's an "implicit cast" in such
cases.