[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: not enough real programmers?
In article <7pe44e$hok$1@ucsnew1.ncl.ac.uk>, on 18 Aug 1999 11:06:54
GMT, "T.W. Seddon" <T.W.Seddon@ncl.ac.uk> wrote:
>Derek Peschel (dpeschel@u.washington.edu) wrote:
>> In article <ufemh248ig.fsf@jtc-home-pc.redback.com>,
>> J.T. Conklin <jtc@jtc-home-pc.redback.com> wrote:
>> >original poster (name has gone!) wrote:
>> >> 1) if (toupper( *ch++)) == 'A') then ch++
>> >
>> >> 1) side-effect from ch++ in a macro which is evaluated twice
>> > ["but toupper is a function!"]
>>
>> You misunderstood. The macro isn't toupper(), it's the whole line. Then
>> someone put ch++ into the macro and the preprocessor expanded it and ch++
>> got written twice and ch got interpreted twice instead of once.
>
>The line as a whole doesn't look too unreasonable. It might be necessary
>to, on each iteration of a loop (say), skip each 'A' and the character
>immediately following.
>
>If this is a mistake, and it's one that lots of people make, then sorry.
>But, I can't see any way in which anyone could write something like the
>above without intending to, so I'm assuming that it was what was meant.
>
>Could the original poster take us through their thinking here?
Yeh, sure. Firstly I must apologise as I did the questions from memory
and off the cuff, which explains why the "then" slipped in.
The point of the first question was to get the interviewee to talk
about side effects in general, using the classic case of the toupper
macro's double usage of its parameter. Also to see if the inteviewee
would say that it was a bad idea to do such things in a macro.
The second question was related somewhat to style. It was to check if
the interviewee could read badly styled code and still understand it.
Yeh, the ideal is that there is a coding standard and all code is the
same, but thats the ideal so there will be variations especially when
third-party code is used.
>> I missed that. Basically, I think the examples were made very quickly.
>> You're supposed to notice a certain important flaw and overlook the others.
>> In other words, you need to have a certain skill in mind-reading.
>
>Is this a sarcastic comment? I cannot tell. I am sure a certain skill in
>mind-reading would come in _very_ useful in many fields apart from
>computing. Telekinesis would also be useful, as it's cheaper than a
>trackball, but I think that's another thread.
<sarcastic mode as well>
Mind reading. Useful! If I could do that then I could look at the
interviewee, do the classic Spock Mind-Meld finger action and decide
immediately if the interviewee was acceptable! <g>
</sarcastic mode as well>
Jon
--
jon@axtell.obvious.demon.co.uk
Remove the obvious bit