Re: Terminology : casting/conversion
- From: Chris Torek <nospam@xxxxxxxxx>
- Date: 11 Mar 2006 17:40:02 GMT
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.)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
.
- Follow-Ups:
- Re: Terminology : casting/conversion
- From: Richard G. Riley
- Re: Terminology : casting/conversion
- References:
- Terminology : casting/conversion
- From: Richard G. Riley
- Terminology : casting/conversion
- Prev by Date: char array to int array
- Next by Date: Re: Learning C
- Previous by thread: Re: Terminology : casting/conversion
- Next by thread: Re: Terminology : casting/conversion
- Index(es):
Relevant Pages
|