POV-Ray : Newsgroups : povray.programming : Re: chi2.cpp Server Time
8 Jul 2024 18:54:02 EDT (-0400)
  Re: chi2.cpp (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Thorsten Froehlich
Subject: Re: chi2.cpp
Date: 6 Dec 2002 14:04:44
Message: <3df0f4cc@news.povray.org>
In article <3df02f7e@news.povray.org> , "Tony[B]" <ben### [at] catholicorg> 
wrote:

> Dunno about the rest of you, but all those gotos in there made me very
> uneasy. Here's a goto-less version, with a few other tweaks here and there.
> Not necessarily better, but more to my liking. Let me know if you agree.
> Large comments and majority of unchanged stuff ommited for brevity. This
> code is completely untested, straight out of Notepad... Enjoy.

As noted in the file, the code is from a library.  It works well and without
problems.  A general rule of all development is to never change a running
system.  Especially not if there is nothing wrong with it.


BTW, gotos are fine, they are just a bit harder to read in their "natural"
form.  However, you use them all the time - in form of the switch-case
statement.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: chi2.cpp
Date: 6 Dec 2002 14:05:34
Message: <3df0f4fe$1@news.povray.org>
In article <3df0f4cc@news.povray.org> , "Thorsten Froehlich" 
<tho### [at] trfde> wrote:

> BTW, gotos are fine, they are just a bit harder to read in their "natural"
> form.  However, you use them all the time - in form of the switch-case
> statement.

I forgot to but a bit  ;-)  at the end of this statement, of course.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Tony[B]
Subject: Re: chi2.cpp
Date: 7 Dec 2002 12:55:39
Message: <3df2361b@news.povray.org>
> As noted in the file, the code is from a library.  It works well and
without
> problems.  A general rule of all development is to never change a running
> system.  Especially not if there is nothing wrong with it.

Yes, that's true. I agree. But still... This file is like from 1987, isn't
there the possibility that from then to now something in it could be
improved in some other equivalent library? :)

> BTW, gotos are fine, they are just a bit harder to read in their "natural"
> form.  However, you use them all the time - in form of the switch-case
> statement.

Interesting. And would if-else statements not do that too?

--
Anthony Bennett


Post a reply to this message

From: Tony[B]
Subject: Cephes
Date: 7 Dec 2002 13:01:46
Message: <3df2378a@news.povray.org>
This was the most recent one I could find. Version 2.8 from 6/4/2000.

http://www.moshier.net/#Cephes

--
Anthony Bennett


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: chi2.cpp
Date: 7 Dec 2002 13:32:06
Message: <3df23ea6$1@news.povray.org>
In article <3df2361b@news.povray.org> , "Tony[B]" <ben### [at] catholicorg> 
wrote:

>> BTW, gotos are fine, they are just a bit harder to read in their "natural"
>> form.  However, you use them all the time - in form of the switch-case
>> statement.
>
> Interesting. And would if-else statements not do that too?

No, a "case" is always a goto with exactly the same abilities as a "natural"
goto!  You may for example write the following perfectly legal code:

int i = 4;
switch(2)
{
    case 1:
        i = 7;
        while(i < 6)
        {
            if(i != 4)
            {
    case 2:
                i++;
            }
        }
        printf("%d", i);
}

Guess what this prints...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Christopher James Huff
Subject: Re: chi2.cpp
Date: 7 Dec 2002 13:35:54
Message: <chrishuff-AEDCB3.13325107122002@netplex.aussie.org>
In article <3df2361b@news.povray.org>, "Tony[B]" <ben### [at] catholicorg> 
wrote:

> Yes, that's true. I agree. But still... This file is like from 1987, isn't
> there the possibility that from then to now something in it could be
> improved in some other equivalent library? :)

Why? It does what it needs to do, so why change it? You're just spending 
time writing and debugging new code, increasing the risk of problems for 
no actual benefit. "If it ain't broke, don't fix it."
Especially when there are other things that *are* broken.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Tony[B]
Subject: Re: chi2.cpp
Date: 7 Dec 2002 20:31:20
Message: <3df2a0e8@news.povray.org>
> No, a "case" is always a goto with exactly the same abilities as a
"natural"
> goto!  You may for example write the following perfectly legal code:

<snips peculiar code>

> Guess what this prints...

5?

--
Anthony Bennett


Post a reply to this message

From: Tony[B]
Subject: Re: chi2.cpp
Date: 7 Dec 2002 20:41:36
Message: <3df2a350$1@news.povray.org>
I don't think that that's any reason to completely discount the fact that
perhaps a newer version provides an easier to read equivalent with perhaps
better performance. We shouldn't shut ourselves in a "don't fix" shell, or
we'll miss all kinds of good stuff out there. I think that now more than
ever this is important, considering the huge undertaking that 4.0 will be.
This is the time to dig out out papers and alternative libraries to find
something we can use later. At least that's the mindset I'm presenting these
things in.

Mind you, I do agree that the bugs in POV have the utmost priority, and that
in fact, these changes I propose are not a good idea.

*goes back to studying for final exams*

--
Anthony Bennett


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: chi2.cpp
Date: 8 Dec 2002 05:41:24
Message: <3df321d4$1@news.povray.org>
In article <3df2a0e8@news.povray.org> , "Tony[B]" <ben### [at] catholicorg> 
wrote:

>> Guess what this prints...
>
> 5?

Nope, it says "while(i < 6) i++;", that is, it continues the loop for 5 < 6,
adds one to 5, and thus prints 6.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: chi2.cpp
Date: 8 Dec 2002 05:43:55
Message: <3df3226b$1@news.povray.org>
In article <3df2a350$1@news.povray.org> , "Tony[B]" <ben### [at] catholicorg>
wrote:

> I don't think that that's any reason to completely discount the fact that
> perhaps a newer version provides an easier to read equivalent with perhaps
> better performance.

Note some functions in 2.8 have not been modified since 2.1 or earlier.

Nevertheless, your argument is valid that one should always use recent
versions of libraries in the general case (also not this one).  We do this
for all external image support libraries, for example.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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