Keith Thompson said:
There's a contact address in the article; I'll send him pointers to
your article and my followup.
With the author's permission, I'm posting his response to my e-mail.
I've rearranged the text to put his response after mine, and I've
added "|| " before my message and "| " before his response.
|| Hello. Somebody just posted a pointer to your article "A 'C'
|| Test: The 0x10 Best Questions for Would-be Embedded Programmers",
|| <
http://www.embedded.com/2000/0005/0005feat2.htm> to the comp.lang.c
|| Usenet newsgroup, pointing out a serious error in the first question.
|| I've posted a followup. You can read the orginal post at
||
||
http://groups.google.com/group/comp.lang.c/msg/131a36cd616fa566
||
|| and my followup at
||
||
http://groups.google.com/group/comp.lang.c/msg/7029524f1567fe2f
||
|| There have been several other responses in the thread; persuading
|| Google Groups to show the tree of responses is left as an exercise.
||
|| (My first attempt to send you this message bounced because I had the
|| wrong e-mail address. I think the article is fairly old; the URL
|| implies that it's from the year 2000 -- though "curl --head" says
|| the "0005feat2.htm" was last modified Tue, Jan 27 2099 23:59:59 GMT.
|| Somebody might want to look into the settings on your web server.)
|
| Hi Keith:
|
| I took a look at your post. The UL outside the brackets was a typesetting
| error that wasn't caught on the proof read. Incidentally, a far more
| interesting thing to note is whether the UL actually buys you anything. I
| think it does, but I've had others that disagree with me.
|
| Regarding Q8 - I think you missed my point. In my experience less than 10%
| of C programmers know what volatile is, let alone all its subtleties. Given
| that this was a C *test*, the objective was more to test than to teach. In
| short if an embedded programmer doesn't know what volatile is, or has a hazy
| knowledge, then they are useless.
|
| In question 14. Regarding the needless cast to the result of malloc(). I
| personally am very cautious with implicit casts. Thus it's my style to
| always cast the result of malloc and other such functions. Having said that,
| I can't remember the last time I used malloc() since heap fragmentation is
| not normally something I can tolerate.
|
| Sticking with question 14, you are correct that I was wrong about the
| results of malloc(0). I erroneously thought that malloc(0) always returned a
| valid pointer. Having said that, the main point of the question was to
| determine which of the two "camps" you fall in to.
|
| Camp "1": The programmer is king. I'm smarter than the compiler, so if I
| want to do something like call malloc(0) then I expect a valid pointer.
|
| Camp "2": I'm human and make stupid mistakes. I'd really like the compiler
| to remind me when I do something stupid, or at least suspicious.
|
| BTW, if you genuinely knew that the results of malloc(0) was implementation
| dependent, then I suspect that you are a compiler writer, or you spend more
| time reading compiler manuals than I do, since I think you'd agree it's a
| pretty obscure point.
|
| I'm sorry that my attitude / tone for Q15 offended you. The article was
| supposed to be light hearted, while at the same time making some good
| points. As to your claim that the solution to Q15 is something every C
| programmer should know - I agree. However, I think you'll find that >95%
| can't answer this question correctly. If you're in an organization with many
| programmers, I'd be interested to see how many of them can answer the
| question correctly. (BTW, the folks that hang out on the comp.lang.c Usenet
| newsgroup probably aren't representative of the programming population.)
|
| Incidentally, what I have found with Q15 is that the better candidates
| instinctively know that the typedef is the better solution - but without
| being able to quite articulate why.
|
| Thanks for writing.