Re: Terminology : casting/conversion
- From: "Richard G. Riley" <rgrdev@xxxxxxxxx>
- Date: 11 Mar 2006 18:49:17 GMT
On 2006-03-11, Chris Torek <nospam@xxxxxxxxx> wrote:
In article <47gdufFf90qmU1@xxxxxxxxxxxxxx>
Richard G. Riley <rgrdev@xxxxxxxxx> wrote:
Would it be wrong to use "implicit casting" instead of the standards
"implicit conversion" when talking about implicit conversions between
certain data types.
It is certainly more consistent (and I think much less misleading)
to use the phrase "implicit conversion". This is because the C
standard defines "cast" as, in effect, "the syntactic construct
consisting of a parenthesized type-name followed by a value
expression, which causes an explicit conversion".
The "followed by a value" part is to handle C99's aggregate constants,
which use remarkably similar syntax, except that the parenthesized
type-name is followed by an open brace. That is:
(int)3.14159
uses a cast, but:
(int []){ 3, 1, 4, 1, 5, 9 }
does not -- the parenthesized type supplies the information needed
to construct the correct aggregate type, here "array 6 of int".
Note that the same sequence of six "int" constants might be used
to initialize something that is not an array at all:
struct zorg {
char a;
double b;
short c;
long d;
float e;
int f;
};
...
(struct zorg){ 3, 1, 4, 1, 5, 9 }
If a "cast" is nothing more than the explicit syntactic construct,
an "implicit cast" must be an "implicit explicit syntactic construct":
oxymoronic, like "large small" or "jumbo shrimp". :-)
(The last line above is meant more to point out that such things
do exist in English, and it would be possible for the C Standard
to define the phrase "implicit cast" as an alternative for "implicit
conversion". But it does not, and there is no need to clutter
one's vocabulary with Extra Alternative Options from the Bureau of
Redundancy Department.)
thanks for the replies guys.
.
- References:
- Terminology : casting/conversion
- From: Richard G. Riley
- Re: Terminology : casting/conversion
- From: Chris Torek
- Terminology : casting/conversion
- Prev by Date: Re: Learning C
- Next by Date: Re: global variables are bad?
- Previous by thread: Re: Terminology : casting/conversion
- Next by thread: Re: Terminology : casting/conversion
- Index(es):
Relevant Pages
|