operands to min and max must have the same type...

Alexandre Oliva aoliva@redhat.com
Wed Mar 5 02:49:00 GMT 2003


On Mar  4, 2003, Benjamin Kosnik <bkoz@redhat.com> wrote:

> -	ptrdiff_t new_size = std::max(2 * old_size, ptrdiff_t(1));
> +	ptrdiff_t new_size = std::max(ptrdiff_t (2 * old_size), ptrdiff_t (1));


> Should be:

> ptrdiff_t new_size = std::max(static_cast<ptrdiff_t>(2 * old_size), ptrdiff_t (1));

Err...  I don't understand.  Why must one of them be a static_cast
while the other is ok as a functional cast?  Are conventions like this
documented anywhere?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc-patches mailing list