Sujet : Re: how cast works?
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 09. Aug 2024, 23:29:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v96580$788h$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla Thunderbird
Bart <
bc@freeuk.com> writes:
On 09/08/2024 18:57, James Kuyper wrote:
...
A cast is a piece of syntax that is used to explicitly request that
a
conversion be performed. Conversions that are explicitly requested in C
code are referred to as casts only by people who don't understand what
they're saying - the standard never refers to them as such.
>
Are you sure? What else would they be known as?
As Keith said, that's a typo - the second "explicitly" should have been
"implicitly".
[...]
Here it uses the term 'explicit cast'. Why is that; isn't the term
'cast' unambiguous without needing to say 'explicit'?
It's redundant, and occurs only once in the entire standard. The purpose
of that redundancy was to emphasize that what the conversion it
describes never happens implicitly (unlike many of the other conversions).
Also, what is exactly is the difference between 'explicit conversion'
and 'explicit cast'?
None
Why can't there also be a similar correlation between 'implicit
conversion' and 'implicit cast'?
The C standard defines "implicit conversion" and "explicit conversion"
in 6.3p1, and the definition it provides for "explicit conversion" is
"those [conversions] that result from a cast operation". it provides a
grammar production for a cast expression, and none for a implicit cast
expression.
even if it did, surely people ought to be allowed to use alternate
terms for an informal discussion? This is a not a committee meeting.
Every time you use a term with a standard-define meaning in a way that
doesn't match the meaning defined for it by the standard, you create
potential confusion. If that's what you want to do, go ahead, but it
seems an odd thing to do.