Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31634
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: What is your favorite WC++IETJ? |
| Date | 2015-04-30 12:18 -0400 |
| Organization | A noiseless patient Spider |
| 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> |
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
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