|
![](/i/fill.gif) |
On 7/23/2011 10:36, Warp wrote:
> But there are many architectures where dereferencing null will trap,
Yes, I know that. :-)
> If dereferencing null is normal in a certain architecture,
I didn't say it's normal. I said it's something someone who knows the
hardware might expect and thus be surprised by the compiler deleting
completely different code.
If I compiled something like that first version for a Z-80, I can easily
believe I would be surprised if that code ever wrote to the interrupt
vector. I'm not criticizing C. I'm simply saying it's reasonable to be
surprised. :-)
> Then these people either have to learn C properly, or not use it.
> It really is a case of "take it or leave it".
Yes. I'm simply pointing out to people who know C very well why it would be
that people who don't know it very well might be surprised. Heck, code like
that wound up in the Linux kernel, so I think it's save to say "it sometimes
surprises even experts", yes?
--
Darren New, San Diego CA, USA (PST)
"Coding without comments is like
driving without turn signals."
Post a reply to this message
|
![](/i/fill.gif) |