Re: maths for programming C++



Robbie Hatley wrote:
"Logan Shaw" <lshaw-usenet@xxxxxxxxxxxxx> wrote:
Richard Heathfield wrote:
August Karlstrom said:

And how would you define a great programmer?

Someone who values readability over correctness, and correctness over
everything else.

Um, I'm really hoping that contains a typo. Readability over correctness?!?
To paraphrase someone else, if correctness isn't a requirement, then I'll
just write

int main ()
{
}

and be done with it.

I'm afraid I have to agree with Mr. Heathfield on that. Buggy-
but-readable programs can easily be fixed.

Not necessarily. If fixing them makes them even slightly less
readable, then it's not allowed under the rules, because readability
is valued more than correctness.

Let me give a concrete example. Here's a program:

#include <stdio.h>

int main ()
{
size_t x = 8;

printf ("%d\n", x);
}

Now, here's a correct program (or at least one with fewer bugs):

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
size_t x = 8;

printf ("%lu\n", (unsigned long) x);

return 0;
}

Which one is more readable? To me, it's the first. There's less
clutter, and it's readily apparent what the programmer intended.
So, under the rules of readability over correctness, the second
program isn't allowed.

- Logan
.



Relevant Pages

  • Re: maths for programming C++
    ... readable, then it's not allowed under the rules, because readability ... int main ... Your second version, and my version, include the cast. ... And under the rules of correctness, the first version isn't allowed either. ...
    (comp.programming)
  • Re: Reading little-endian data from a file in a portable manner
    ... Just a couple of minor followup comments... ... weight on correctness; basically, ... if I may be allowed I will re-write just slightly (32 bit int ... icccr16 generated shorter code for the test ...
    (comp.lang.c)
  • Re: maths for programming C++
    ... Someone who values readability over correctness, ... given the choice between an unreadable, correct program and a readable, incorrect program, I would choose the latter, because it offers me more chance of getting a readable, correct program. ... int main ...
    (comp.programming)
  • Re: maths for programming C++
    ... Someone who values readability over correctness, ... the choice between an unreadable, correct program and a readable, incorrect program, I would choose the latter, because it offers me more chance of getting a readable, correct program. ... int main ...
    (comp.programming)
  • Re: Strange problem at write file
    ... Derek wrote: ... that's a performance issue, not a correctness issue. ... > int c; ... producing any error message. ...
    (comp.lang.java.programmer)