473,799 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C style casts

Where is it in the standard that C style casts are labeled depricated?
I read that on a lot of websites but I can't find it in the standard.
I have BS ISO/IEC 14882:2003 (2nd ed) as published by John Wiley &
Sons. I'm in the middle of a standard argument on this issue and
safety isn't convincing my opponents - deprication might.

Jan 31 '06 #1
24 1983
* ro**********@gm ail.com:
Where is it in the standard that C style casts are labeled depricated?
They aren't.

I read that on a lot of websites but I can't find it in the standard.
I have BS ISO/IEC 14882:2003 (2nd ed) as published by John Wiley &
Sons. I'm in the middle of a standard argument on this issue and
safety isn't convincing my opponents - deprication might.


You can't force anyone to write decent code. You can't force anyone to
share your values, your opinion on what is good and bad. So if they
insist on using C style casts, let them.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jan 31 '06 #2
ro**********@gm ail.com wrote:
Where is it in the standard that C style casts are labeled depricated?
Deprecated? Nowhere. 5.4 describes the explicit type conversion and what
it means.
I read that on a lot of websites but I can't find it in the standard.
Because it's not there. What web site claims that it's deprecated? Can
you post a link?
I have BS ISO/IEC 14882:2003 (2nd ed) as published by John Wiley &
Sons. I'm in the middle of a standard argument on this issue and
safety isn't convincing my opponents - deprication might.


Sorry to disappoint you. No deprecation on that one.

V
--
Please remove capital As from my address when replying by mail
Jan 31 '06 #3

Victor Bazarov wrote:
ro**********@gm ail.com wrote:
Where is it in the standard that C style casts are labeled depricated?
Deprecated? Nowhere. 5.4 describes the explicit type conversion and what
it means.


Yep, that's what I see...
I read that on a lot of websites but I can't find it in the standard.


Because it's not there. What web site claims that it's deprecated? Can
you post a link?


http://www.google.com/search?hl=en&q...ecated&spell=1

There's a few. A good section of the first few pages actually say it,
the others just contain all words.

Jan 31 '06 #4
Victor Bazarov wrote:
ro**********@gm ail.com wrote:
Where is it in the standard that C style casts are labeled depricated?


Deprecated? Nowhere. 5.4 describes the explicit type conversion and what
it means.
I read that on a lot of websites but I can't find it in the standard.


Because it's not there. What web site claims that it's deprecated? Can
you post a link?
I have BS ISO/IEC 14882:2003 (2nd ed) as published by John Wiley &
Sons. I'm in the middle of a standard argument on this issue and
safety isn't convincing my opponents - deprication might.


Sorry to disappoint you. No deprecation on that one.

V

In this context, deprecation means 'frowned upon' not 'no longer
supported'. So in this sense, they are deprecated. Clearly their
addition to the language implied that their use, in most cases, was
preferred to C style casts.
--dakka
Jan 31 '06 #5
ro**********@gm ail.com wrote:
Victor Bazarov wrote:
ro**********@ gmail.com wrote:
Where is it in the standard that C style casts are labeled depricated?


Deprecated? Nowhere. 5.4 describes the explicit type conversion and what
it means.

Yep, that's what I see...

I read that on a lot of websites but I can't find it in the standard.


Because it's not there. What web site claims that it's deprecated? Can
you post a link?

http://www.google.com/search?hl=en&q...ecated&spell=1

There's a few. A good section of the first few pages actually say it,
the others just contain all words.


The first two pages that come up are about the D language, and not C++.
The third, fourth, and fifth pages do not have it. On the sixth, somebody
named "Chuck Allison" claims they are deprecated, you need to take it up
with him.

The rest... I have no time for chasing ghosts. I didn't find any mention
of deprecation of C-style casts in the C++ Standard.

V
--
Please remove capital As from my address when replying by mail
Jan 31 '06 #6

Dakka wrote:
In this context, deprecation means 'frowned upon' not 'no longer
supported'. So in this sense, they are deprecated. Clearly their
addition to the language implied that their use, in most cases, was
preferred to C style casts.


Actually I have run into quite a few websites that state that the
standard committee depricated C-style casts; the committee would not
*depricate* a feature if they didn't mean the formal definition. I
don't know if any in the google search I posted do but I have seen it
in at least 3 different sources so I was rather confused that I
couldn't find any mention of that in the standard (in fact as mentioned
here the only text in the standard I could find on C-Style cast
describes what they are/do and makes no mention of deprication).
Depricated in that context to me means the next standard very well
might not have them and in fact this is exactly what websites that make
this claim say.

Perhaps it is in an addendum or something?

Jan 31 '06 #7
Dakka wrote:
Victor Bazarov wrote:
ro**********@gm ail.com wrote:
Where is it in the standard that C style casts are labeled depricated?

Deprecated? Nowhere. 5.4 describes the explicit type conversion and
what
it means.
I read that on a lot of websites but I can't find it in the standard.

Because it's not there. What web site claims that it's deprecated? Can
you post a link?
I have BS ISO/IEC 14882:2003 (2nd ed) as published by John Wiley &
Sons. I'm in the middle of a standard argument on this issue and
safety isn't convincing my opponents - deprication might.


Sorry to disappoint you. No deprecation on that one.

V


In this context, deprecation means 'frowned upon' not 'no longer
supported'.


In what context?

The OP specifically asked about deprecation of C-style casts in the
Standard. There is none. The Standard does not contain any human emotion
or any judgement. It cannot. Nothing is "frowned upon" in the Standard.
So in this sense, they are deprecated. Clearly their
addition to the language implied that their use, in most cases, was
preferred to C style casts.
Addition of what to which language?
--dakka


V
--
Please remove capital As from my address when replying by mail
Jan 31 '06 #8
ro**********@gm ail.com wrote:
Dakka wrote:
In this context, deprecation means 'frowned upon' not 'no longer
supported'. So in this sense, they are deprecated. Clearly their
addition to the language implied that their use, in most cases, was
preferred to C style casts.


Actually I have run into quite a few websites that state that the
standard committee depricated C-style casts; the committee would not
*depricate* a feature if they didn't mean the formal definition. I
don't know if any in the google search I posted do but I have seen it
in at least 3 different sources so I was rather confused that I
couldn't find any mention of that in the standard (in fact as mentioned
here the only text in the standard I could find on C-Style cast
describes what they are/do and makes no mention of deprication).
Depricated in that context to me means the next standard very well
might not have them and in fact this is exactly what websites that make
this claim say.

Perhaps it is in an addendum or something?

Interestingly, Stroustrup also refers to C style casts as deprecated in
the C++ Programming Language, Special Edition, 2000, pp 818-819

Feb 1 '06 #9
Victor Bazarov wrote:
Dakka wrote:
Victor Bazarov wrote:
ro**********@gm ail.com wrote:

Where is it in the standard that C style casts are labeled depricated?
Deprecated? Nowhere. 5.4 describes the explicit type conversion and
what
it means.

I read that on a lot of websites but I can't find it in the standard.
Because it's not there. What web site claims that it's deprecated? Can
you post a link?

I have BS ISO/IEC 14882:2003 (2nd ed) as published by John Wiley &
Sons. I'm in the middle of a standard argument on this issue and
safety isn't convincing my opponents - deprication might.
Sorry to disappoint you. No deprecation on that one.

V
In this context, deprecation means 'frowned upon' not 'no longer
supported'.


In what context?


Take out your dictionary, V and look up the meaning of the word.

The OP specifically asked about deprecation of C-style casts in the
Standard. There is none. The Standard does not contain any human emotion
or any judgement. It cannot. Nothing is "frowned upon" in the Standard.
> So in this sense, they are deprecated. Clearly their
addition to the language implied that their use, in most cases, was
preferred to C style casts.
Addition of what to which language?


Well we're not talking about Ada are we? Probably C++ - what do you think?

--dakka


V


--dakka
Feb 1 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
2559
by: Steven T. Hatton | last post by:
The code shown below is an example from the Coin3D documentation. I believe the use of the C-style cast is safe under the circumstances, but from what I've been exposed to (TC++PL(SE)), I would favor using a static_cast. Is there any technical reason to favor the C-style over a static_cast? http://doc.coin3d.org/Coin/index.html void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) {
15
1735
by: Christopher Benson-Manica | last post by:
If you had an unsigned int that needed to be cast to a const myClass*, would you use const myClass* a=reinterpret_cast<const myClass*>(my_val); or const myClass* a=(const myClass*)myVal; ?
3
1473
by: Howard | last post by:
Hi, I am maintaining a lot of code that is rife with C-style casts. I've seen a lot of comments that one should not use C-style casts at all. But I'm wondering what harm there could be in doing so with the built-in types. For example, if you have a long which needs to be passed to a function as an unsigned long, or a char* that needs to be passed as an unsigned char*, or an unsigned int that needs to be passed as a long, isn't it...
1
1395
by: Roy Smith | last post by:
I've got about 100 KLOC in which I want to find any uses of old C-style casts. Are there any good tools for this? Has anybody come up with a regex which does a decent job of finding them, or are there better ways to do it?
3
2311
by: Neil Zanella | last post by:
Hello, I would like to ask the following question concerning the C# as operator. I would like to know whether the difference between using a C-style cast such as double x = 0; float y = (double) x; and using the as operator is simply that as works on references rather
11
18270
by: esuvs81 | last post by:
Hi all. In short, is there any performance difference between: float f = 10.0f; int i = static_cast<int>(f); and float f = 10.0f; int i = int(f);
2
1383
by: Noah Roberts | last post by:
I have a class, that inherits from a class that inherits virtually from another class. I have a breakdown occuring and it is not wrt the virtually inherited class but one of the other MIed pure virtual classes. I get this in my call stack at the point of explosion: Flo.exe!DDocument::Dispatch(DFZone * ptr=0x0298d260) Line 94 + 0x32 bytes C++ Flo.exe!DDocument::Dispatch(DFZone * __A0=0x0298d260) + 0x2f
5
5930
by: brekehan | last post by:
I've always been a little sketchy on the differences between static, dynamic, and reinterpret casting. I am looking to clean up the following block by using C++ casting instead of the C style casting. from what I am reading, I should use reinterpret cast in this situation, is that correct? Why does static and dynamic casting fail me? // please excuse the windows types, it is necessary in this code, // but the question remains C++ related
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.