POV-Ray : Newsgroups : povray.bugreports : update of stable branch : Re: update of stable branch Server Time
24 Apr 2024 21:41:26 EDT (-0400)
  Re: update of stable branch  
From: clipka
Date: 3 Dec 2016 12:20:34
Message: <5842fee2$1@news.povray.org>
Am 03.12.2016 um 09:14 schrieb Le_Forgeron:

> So far so good, but on the same line it could be kind to also update it
> for the gcc 6.2 compiler family: since 6, it does not compile any more
> due to the enforcement of stricter rules about type promotions

Well, now that you have kindly let us /know/ about this issue, we can
indeed be so kind to try and solve it ;)


> base/image/openexr.cpp:160:36: error: no match for ‘operator==’ (operand
> types are ‘pov_base::IOBase’ and ‘bool’)
>     if(is.seekg((unsigned long)pos) == false)
> 
> 
> and
> 
> base/image/hdr.cpp:236:25: error: no match for ‘operator==’ (operand
> types are ‘pov_base::IStream’ and ‘bool’)
>    if(file->Read_Byte(b) == false)
> 
> 
> basically, all that would be needed is something like
> 
>
https://bitbucket.org/LeForgeron/povray/commits/d943647985cad23ff654abec4ecfde0f639eae4c
> 
> (an explicit bool operator in fileinputoutput.h, instead of -- or in
> addition to -- the now useless operator!() )

That would be a poor approach; after all, the stricter rules regarding
conversion to bool are there for a reason. A stream is not a boolean
expression, and strictly speaking the proper test should invoke the
`eof()` function.

Besides, statements like `if(EXPRESSION == true)` are tautologic
abominations anyway, and `if(EXPRESSION == false)` isn't much better;
such statements should instead be written as `if(EXPRESSION)` or
`if(!EXPRESSION)`.

Which, by the way, is also the solution to the reported problem, as
IOBase is already equipped to support the convention that `if(STREAM)`
and `if(!STREAM)` are idioms for `if(STREAM is good)` and `if(STREAM is
good)`.


Let me know where corresponding changes need to be made, and I'll see
that they're checked in. (A quick glance at `openexr.cpp` suggests that
only the one line is affected, but an equally quick glance at `hdr.cpp`
suggests that multiple lines need changing).


Post a reply to this message

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