Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Percentage of error checking code

Reply
Thread Tools

Re: Percentage of error checking code

 
 
88888 Dihedral
Guest
Posts: n/a
 
      03-03-2013
James Kanze於 2013年3月1日星期五UTC+8上午1時23分20秒 道:
> On Tuesday, February 26, 2013 6:51:34 PM UTC, Paavo Helde wrote:
>
> > Öö Tiib <(E-Mail Removed)> wrote in

>
>
>
> > news:(E-Mail Removed):

>
>
>
> > > For example in the light of OP question they try to fix

>
> > > programming errors runtime. It is impossible task since

>
> > > programming errors are in the part that "fixes" too.

>
>
>
> > For programming errors there are various asserts.

>
> > Incidentally, it appears our codebase contains slightly more

>
> > assert lines than throw lines.

>
>
>
> And what about error checking that uses neither asserts nor
>
> exceptions?
>
>
>
> Or more generally: what about a program that uses the classical
>
> line oriented input idiom:
>
>
>
> std::string line;
>
> int lineNumber = 0;
>
> while ( std::getline( file, line ) ) {
>
> ++ lineNumber;
>
> std::istringstream parser( line );
>
> if ( parser >> i >> j >> k ) { // For example...
>
> // ...
>
> }
>
> }
>
>
>
> What part of that code is "error handling"? Without any error
>
> checking, it might be simply:
>
>
>
> while ( file >> i >> j >> k ) {
>
> }
>
>
>
> No need to keep track of the line number, for example, if I'm
>
> not going to output it in case of an error. No need for the
>
> separate `std::istringstream` if I don't need to check the
>
> format, and resynchronize in case of an error. And so on.


Normally only those control parts that have to survive after an I/O or
memory error needs to be carefully tested in the developing phase.

Please don't all expect all programmers can design as the OS programmers
in the application levels.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Percentage of error checking code Jorgen Grahn C++ 4 02-28-2013 05:10 PM
Re: Percentage of error checking code Stefan Ram C++ 0 02-24-2013 02:51 PM
needed percentage James MCSD 3 05-12-2004 03:34 PM
Percentage of switched vs. non-switched Ethernet Networks ??? Chris Cisco 8 04-15-2004 09:56 PM
Percentage C# vs VB.NET Justin MCSD 2 07-25-2003 11:40 PM



Advertisments