On 16 Feb 2007 04:01:14 -0800, "santosh" <sa*********@gmail.comwrote
in comp.lang.c:
>
Nishu wrote:
Hi all,
What is difference between typecasting and casting? I used to think
that both are same; but few days back someone pointed out here that
these are different. Vague guess, Is it that typecasting means casting
using typedef? I just want to confirm it.
I think, in C atleast, the more precise term is cast. The act of
making a cast is called casting. It's often used only for explicit
casts, i.e. those that you explicitly write in the source. Implicit
casts, i.e. those that happen due to the rules of C for evaluating
expressions, are probably better called as implicit conversions.
I know that Keith already responded, but I don't think he was detailed
enough.
C allows conversions of some types to others. Some of these
conversions are automatic, happening in the course of evaluating an
expression, performing an assignment, or passing an argument to a
prototyped function. Other casts require the use of a cast operator.
Since the only thing that performs a cast is a conversion operator,
all casts are explicit. There is no such thing as an "implicit cast",
but there is an "implicit conversion".
The first sentence of 6.3 Conversions of the C standard describes this
concisely:
"Several operators convert operand values from one type to another
automatically. This subclause specifies the result required from such
an implicit conversion, as well as those that result from a cast
operation (an explicit conversion)."
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html