If C is so evil why is it so successful?

dwight dkelvey at hotmail.com
Wed Apr 12 23:37:22 CDT 2017


I know most don't get it but I like Forth because it is easy to follow the program flow and easy to test. C has too much boilerplate to solve the problem of not being able to use white space to keep things organized.

One uses Forth like a combination assembler and high level language. Most all the stack fiddle faddle is hidden at the lower assembly like levels. The high level code is like reading sentences. It always seems to me to be the most straight forward way to tell the computer what to do.

The order is left to right, top to bottom.

Testing can be done at any level, solving the complexity problem of proper testing.

I see too many programmers testing a program at the top level with something like 20 decision points to navigate through. When it seems to work, they call it tested. No wonder things are getting too complex to fix.

It isn't really the programming languages fault but most programming languages don't make it any easier.

Dwight


________________________________
From: cctalk <cctalk-bounces at classiccmp.org> on behalf of Eric Smith via cctalk <cctalk at classiccmp.org>
Sent: Wednesday, April 12, 2017 2:33:38 PM
To: Sean Conner; General Discussion: On-Topic and Off-Topic Posts
Subject: Re: If C is so evil why is it so successful?

On Wed, Apr 12, 2017 at 9:55 AM, Sean Conner via cctalk <
cctalk at classiccmp.org> wrote:

>   Yeah, I'm having a hard time with that too.  I mean, pedantically, it
> should be:
>
>         #include <stdlib.h>
>         int main(void) { return EXIT_SUCCESS; }
>
> where EXIT_SUCCESS is 0 on every plaform except for some obscure system no
> one has heard of but managed to influence the C committee back in the late
> 80s.
>

Returning zero from main to indicate success is perfectly valid according
to the most recent three C standards.  ISO/IEC 9899:1990(E) §7.10.4.3,
ISO/IEC 9899:1999(E) §7.20.4.3 ¶5 and ISO/IEC 9899:2011(E) §7.22.4.4 ¶5
both requires that either 0 or EXIT_SUCCESS as an argument to exit() be
considered success.  EXIT_SUCCESS may or may not be zero, but zero is
considered success regardless of that.

One annoyance with the way the standard defines the EXIT_x macros is that
if you use other exit status values, including those from sysexits.h (not
part of the C standard), it's possible that an intended failure status
value might happen to match EXIT_SUCCESS on some standard-compliant
implementation.

§5.1.2.2.3 ¶1 of both :1999 and :2011 state that if execution reaches the
closing brace of main without a return statement, that it is equivalent to
returning zero, so even the return statement in this alleged non-portable
example is unnecessary.

On the other hand, the earlier ISO/IEC 9899:1990(E) §5.1.2.2.3 says that
main returning with no value yields an undefined termination status.

-- Eric "not a language lawyer but I play one on the internet" Smith


More information about the cctalk mailing list