POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: (And in Haskell. Obviously.) Server Time
1 Oct 2024 09:22:09 EDT (-0400)
  Re: (And in Haskell. Obviously.)  
From: Slime
Date: 20 Sep 2008 16:05:30
Message: <48d5578a$1@news.povray.org>
> I have a similar issue with stuff like
>
>   while (*x++ = *y++) {}

FYI, I have an issue with stuff like that too. C and C++ do make it easy to 
write bad code. This is the second time you've mentioned that example, so I 
assume someone once showed it to you and thought they were being clever. 
They weren't! Or maybe it's just a popular example, because I was just 
reading a book about coding style last night that gave that as a bad 
example.

That code tries to do too much at once and is difficult to understand. If 
you made a small mistake while writing it, it wouldn't be immediately 
obvious that there's a problem with the logic. It's bad code. Its only use 
is to help you understand operator precedence and the behavior of the 
different operators. It's very possible to write code that does the same 
thing in a clearer way.

C and C++ just require responsibility. =)

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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