[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: not enough real programmers?
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?
> 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.
--
--Tom
this space filled with this | this space not filled with this space filled
intentionally ............. | with this intentionally unintentionally ....