Talk:Type conversion

From Wikipedia, the free encyclopedia

[edit] Off topic

This article is off topic. Most of it is not "Type conversion" but "tutorial to C/C++ cast operation".

I did some to improve (see history) but I would ask the C/C++ advocates to consider two things:

  1. tutorials belong to wikibooks.
  2. that there are other programming languages where "Type conversion" has a more broader meaning.

and maybe improve the C/C++ chapter.

You are right in that the current article is not good at all. But we need to remember that C++ has quite complex type conversion system, compared with others. The problem is the shortcoming, which is not intentionally done by C/C++ advocates but is mere result of lack of contributions so far. If you think the article goes too deep, take a look at LR parser and the like. -- Taku 04:27, Nov 30, 2004 (UTC)
Did you read my Ada article? C++ is not the only language with a complex type conversion system. And of corse is should be described in wiki. The question I was trying to raise was "wikipedia vs wikibooks". How much of C/C++ cast need to be described in wikipedia "The Free Encyclopedia" and what should better moved to wikibooks "Think Free. Learn Free". --Krischik 09:43, 30 Nov 2004 (UTC)
I support the idea of a merger between "typecasting" and "type conversion". I was searching for dynamic_cast<>. The first link I took brought me to "typecasting". However, I found the explanation on "type conversion". --Kriti 05:24, 24 Aug 2005(UTC)
I agree, typecasting needs to be merged with this article. Both articles need work. -- Doug Bell (talk/contrib) 20:52, 16 January 2006 (UTC)
I am looking for a way to convert a string to integer when you know the string character is a number like 7. --Mrja84 20:14, 11 Oct 2005(ESDT)
Of course, this depends on the language and primitives you want to use. But since you're asking, the answer could be *string - '0'. --TuukkaH 14:45, 12 October 2005 (UTC)
I believe there should be a least 3 separate pages linked from the Type_conversion page, those being pages for static_cast, reinterpret_cast, and dynamic_cast. --IanVaughan 11:44, 9 Nov 2006 (UTC)
I find this quite confusing, I have to say. Type conversion and type casting are very different things. Type casting being making the compiler think that something is a different type, and type conversion actually turning one type into another, in some fashion, say using atoi, in C or Integer.parseInt in Java. K.

What is the aviation reference doing in this article? It needs to be moved to a separate article. -- Doug Bell (talk/contrib) 20:52, 16 January 2006 (UTC)

Ditto. One tiny section on aviation followed by an article on computer science is completely out-of-place. It should be moved to a separate article with a disambiguation page. -- Andrés Santiago Pérez-Bergquist 23:41, 16 February 2006 (UTC)

[edit] Inaccuracies

The section on implicit type conversion contained false and misleading statements:

  • "For example, in the above comparisons, there would be a loss of information in a conversion from type double to type int if the value of d is larger than i can hold."
    False. The comparisons listed do not involve any conversion from double to int, but the other way around. Actually, any comparison involving a double and an int will have the int promoted to double, not the other way around.
  • Conversely, converting from an integral representation to a floating-point one can also lose precision, as floating-point representations are generally not capable of holding integer values precisely.
    Inaccurate. What is true is that a floating-point representation of n bits can never hold all integer values of n bits precisely, since there's just not enough room for both the exponent and the significand. However, an IEEE 754 double precision type is capable of representing all 32-bit integer values exactly, for example, so this statement is misleading, especially in the given context. 82.95.254.249 18:12, 29 March 2007 (UTC)
    • 32 bit to double can't lose precision but 64 bit to double or 32 bit to float can but i agree that section needs a rewrite. Plugwash 01:19, 31 March 2007 (UTC)