Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail From: "Duga Chernobyl" Newsgroups: comp.lang.c++ Subject: Re: which of these 3 casts would you prefer? Date: Fri, 26 Aug 2011 15:19:59 +0200 Organization: ATMAN - ATM S.A. Lines: 51 Message-ID: References: NNTP-Posting-Host: user-109-243-177-112.play-internet.pl Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Trace: node2.news.atman.pl 1314364800 23708 109.243.177.112 (26 Aug 2011 13:20:00 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Fri, 26 Aug 2011 13:20:00 +0000 (UTC) User-Agent: Opera Mail/11.50 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:9335 Dnia 26-08-2011 o 14:40:27 A napisa=C5=82(a): > I do not understand though reluctance to use C style casts. > > They can cast to reinterpret_cast but they also try out the weaker cas= t > before. It is just automatic way to do what you would do manually - fi= rst > try const_cast, then static_cast and finally reinterpret_cast... yes, = it = > can > use reinterpret_cast but you would have to use it anyway in a particul= ar > case where you really need it. > > So what's wrong with little automation, providing that you know what y= ou = > are > doing with casts? > > Sometimes you are tired and you don't want to check, if something is goo= d = or bad. For me compiler is the best friend (in programming ;-)) and alwa= ys = set this settings: Try search all convertions with c++ style and all with c style. What, do= = you think, is easier to find all of them? -Wall -Wextra -pedantic -g -pg It is not little automation, but great help ;-) if you make a mistake f.e if (a =3D 1) gcc will you ask, if really means it. If you are programmer= , = the common sense makes you to be open for all suggestions of compiler. Many people thinks, that computer is evil, but computer makes exactly wh= at = we said (but not very often what we want ;-))