POV-Ray : Newsgroups : povray.off-topic : All your radix are belong to us! : Re: All your radix are belong to us! Server Time
29 Jul 2024 16:27:03 EDT (-0400)
  Re: All your radix are belong to us!  
From: Darren New
Date: 23 Jul 2011 19:05:04
Message: <4e2b53a0@news.povray.org>
On 7/23/2011 10:51, Warp wrote:
> Darren New<dne### [at] sanrrcom>  wrote:
>>>     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?
>
>    But wasn't it a bug, rather than an intentional "trick" which the
> programmers didn't realize would trigger undefined behavior?

Yes. It was a bug caused by the programmer not knowing a null pointer check 
would not wind up in the object code, because they accessed the pointer 
first. I.e., it was pretty much exactly the contains_null_check code on the 
second link.

I.e., I'm pretty sure anyone committing code to the Linux kernel "knows C 
properly."  It really is a surprising language.  Saying "real programmers 
never make this sort of mistake" is a no-true-scotsman argument.

I'm not saying anything is *wrong* with C or the decisions the standards 
committee made. Just that expressing surprise that it's as tricky as it is 
doesn't imply you're ignorant.  "Real programmers think C isn't surprising, 
because if you're surprised by C, it means you're not a real programmer."

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.