Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31634

Re: What is your favorite WC++IETJ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.java.programmer
Subject Re: What is your favorite WC++IETJ?
Date Thu, 30 Apr 2015 12:18:14 -0400
Organization A noiseless patient Spider
Lines 36
Message-ID <mhtkib$n7t$1@dont-email.me> (permalink)
References <WCIETJ-20150430130949@ram.dialup.fu-berlin.de> <mht8ic$20f$1@news.albasani.net> <abbreviations-20150430152141@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Date Thu, 30 Apr 2015 16:17:15 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5dfcaf843262377062d568c34777fa3"; logging-data="23805"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194WtMmPfZV97mr0x5zmGGpwP0XCNab60k="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <abbreviations-20150430152141@ram.dialup.fu-berlin.de>
Cancel-Lock sha1:NxVhWjfk6y5I9ZYPoROGquQRtXU=
Xref csiph.com comp.lang.java.programmer:31634

Show key headers only | View raw


On 4/30/2015 9:28 AM, Stefan Ram wrote:
<snip>
> 
>   Well, C++ also has its difficulties here. For example, when
>   one wants to read a number, but the user enters a string,
>   one needs to reset the stream in a laborious way, before the
>   read operation can do another attempt at reading a number:
> 
> int x; bool ok; do
> { ok = ::std::cin >> x;
>   else
>   { ::std::cin.clear();
>     ::std::cin.ignore
>     ( ::std::numeric_limits< ::std::streamsize >::max(), '\n' ); }}
> while( !ok );
> 
>   and the meaning of »ok = ::std::cin >> x« is also not
>   very obvious to a beginner.
> 

Which is why it's a bad idea to write code such as this, especially
without any comments.  A code review should reject it (and would on the
projects I have managed).

You can obfuscate your code in almost any language (including Java).
Some make it easier than others.  But that does not mean it's a good
idea.  Unless there is an overwhelming reason otherwise, code should
always be clear and easy to understand - even if it does take a few more
lines to make it so.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: What is your favorite WC++IETJ? Sebastian <news@seyweiler.dyndns.org> - 2015-04-30 14:52 +0200
  Re: What is your favorite WC++IETJ? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-04-30 10:03 -0400
  Re: What is your favorite WC++IETJ? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-30 12:18 -0400
  Re: What is your favorite WC++IETJ? Robbie Brown <rob@example.com> - 2015-04-30 20:37 +0100

csiph-web