G
goose
It seems that none of you have ever read a Pascal or Delphi manual !!
Seeing as how we discuss only the C language here, I wonder
how you could consider that statement to be relevant at all.
It seems that none of you have ever read a Pascal or Delphi manual !!
in 724501 20070315 080211 goose said:Seeing as how we discuss only the C language here, I wonder
how you could consider that statement to be relevant at all.
I've yet to see a good reason why one should use the term typecast
instead of cast. A beginner at programming won't know either term so
learning the correct terminology for C is no hardship in this case, and
someone more experienced who has come across the term typecast is highly
unlikely to be confused by C books using the term cast.
So far I have only seen the term typecast used by people who do not know
the language and in resources which are bad for other reasons. So I
think the only reason some beginners use it is that they are learning
from poor resources, and the use of the word typecast is a good
indicator that the person using it has a poor knowledge of C even if the
person using it is the author of a book on C.
Please read the thread before replying. At least two people said they
had never heard of the term "typecast" being used in ANY programming
language.
Yevgen Muntyan said:Flash Gordon wrote:
...
Take a look at this:
http://www.cs.cf.ac.uk/Dave/C/node9.html#SECTION00930000000000000000
Is it a bad one?
When it says: "A good rule to follow is: If in doubt cast."!? That's not
bad, that's irretrievably rotten.
in 724514 20070315 094232 Richard Heathfield said:Bob Martin said:
I hadn't, either - except (erroneously) in C and, later, C++.
So I hauled five language texts at random from my shelf, non-critically
(I didn't validate for whether I liked the described languages, or
indeed the authors!) and glanced through their indices:
"Programming with PASCAL" (Konvalina & Wileman, 1987). I found no entry
for "typecast".
"The Java Programming Language" (Arnold, Gosling, and Holmes, 2000). The
entry "type casting" does appear, but I could not find the word
"typecast" itself. "Type casting" is, of course, to "typecast" as
"operator overloading" is to "operatoroverload".
"Perl in a Nutshell" (Siever, Spainbour & Patwardban. 1999). I found no
index entry for "typecast".
"The C++ Programming Language" (Stroustrup, 2000). I found no index
entry for "typecast".
"PHP and MySQL" (Ullman, 2005). An entry exists for "type casting" (see
above), but nothing under "typecast" or "typecasting".
Bob said:typecast
Google for typecast shows 961,000 hits, including most Borland sites on
Delphi and Object Pascal.
It has been around for at least 25 years and I find it hard to believe that there
are serious programmers who have never come across it.
in 724622 20070316 000018 Flash Gordon said:Bob Martin wrote, On 15/03/07 19:03:
The work is obviously a far larger place than you had believed. Probably
for the 1st 10 years of my professional career I had never needed to do
any forced conversion between types apart from the odd use of 'ord' and
the 'chr' in Pascal (if I've remembered the function names correctly).
Since I always considered the ability to mix floating point and integer
types to be natural I never even thought about whether there was some
specific general term for such conversions. Then I first came across the
need to force type conversions it was in C and K&R use the term cast, so
that is the term I use. So whilst it is *possible* I had heard the term
typecast and forgotten it, it is definitely true that it was not in
anything like regular use anywhere I've worked in the past 20 years.
Bob said:You obviously didn't write serious Pascal code ;-)
Bob said:You obviously didn't write serious Pascal code ;-)
Do linkers [1] and functional-language interpreters [2]
count as serious?
Bob Martin said:You obviously didn't write serious Pascal code ;-)
Keith Thompson said:I've certainly written serious Pascal code, and I've never seen or
heard the word "typecast" applied in a Pascal context.
(I've never used Delphi and Object Pascal, though.)
in 724816 20070316 203232 Keith Thompson said:I've certainly written serious Pascal code, and I've never seen or
heard the word "typecast" applied in a Pascal context.
(I've never used Delphi and Object Pascal, though.)
Bob Martin said:What's with all you people rushing forward to boast of your ignorance?
Your not having come across "typecast" proves nothing.
in 724933 20070317 092551 Keith Thompson said:We're not boasting of our ignorance. We're refuting your apparent
claim that anyone who as written "serious Pascal code" must therefore
be familiar with the term.
Bob said:.... snip ...
You are not refuting anything - though you might be trying.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.