Russel Winder wrote:
> > hands up those who call themselves C programmers who don't understand
> > this C program:
> >
> >   main()
> >   {
> >     printf("Hello world.\n");
> >   }
> >
> > (Those with their hands in the air: you're fired.)
> 
> I am not so sure you should be firing readers, you perhaps ought to be firing the
> writer: the above is really awful code.  

Perhaps for a production 'Hello World' printer, but not for a trivial-yet-working
example to put up against Derek's claim that program understanding might not exist,
which is what I was doing.  I'm not trying to teach C programming here, and I
think focussing on arguable deficiencies in the quality of the example code
is missing the point about whether program understanding might exist.

I think it's interesting that the responses have been of the form 'this is 
not a very good program' or 'this program has ambiguous or undefined behaviour'
rather than 'no C programmer could understand this program'.  I believe this
means something. :-)

> The issue here is that understanding requires an operational semantics as well as
> an ability to read the code.

Which I'd expect any competent C programmer to be able to divine, discover 
or invent as appropriate as a part of their mission to understand the code.

(By the way, the program text above compiles and runs without warning or error on 
my Linux workstation using the default settings for the system's usual tools.)
-- 
Frank Wales [[EMAIL PROTECTED]]

- Automatic footer for [EMAIL PROTECTED] ----------------------------------
To unsubscribe from this list, mail [EMAIL PROTECTED]  unsubscribe discuss
To join the announcements list, mail [EMAIL PROTECTED] subscribe announce
To receive a help file, mail [EMAIL PROTECTED]         help
This list is archived at http://www.mail-archive.com/discuss%40ppig.org/
If you have any problems or questions, please mail [EMAIL PROTECTED]

Reply via email to