[Gecode] Some issues in the code you contributed...

Guido Tack tack at ps.uni-sb.de
Sat May 1 17:47:02 CEST 2004


Hello.

On Saturday 01 May 2004 13:57, Christian Schulte wrote:
> Dear all,
>
> I stumbled over the following two issues and some minor stuff:
>
> If you have a template <class A, class B>, then you can't have a template
> <class A, class A>. First of all, this awkward construction is not
> necessary, if you want to have that better iterator, then just give it a
> different name. Grep for #ifdef FUCKED. Your code might not compile/work
> right now.

I think this was intended to be a specialized version. The problem was that 
you relied on the two arguments being of the same type to exchange them 
(using Common::swap), that's why we had to split it in a generic and a 
specialised version. The code compiled and worked, although I don't know at 
all what the msvc might think about it...

> The max and min double values are exactly those for which floating point
> arithmetic is exact. Basing the configuration on the fact that long long is
> 64 bits is worse than using the predefined constant (which is guaranteed by
> the C++ standard afaik).

The configuration is not based on that fact. It tests whether this holds, in 
which case the constants can be computed the way I did. Otherwise, they have 
to be computed the way you did in arith-conf.cc, which will be automatically 
done by make. I would be very surprised if these constants were really 
guaranteed by the C++ standard, I couldn't find anything like that on the web 
or in "The C++ programming language".

The problem with computing the constants at "configure" time the way you did 
in arith-conf.cc is if you try to cross-compile, as you have to run the 
generated executable... That is why I tried to get around this if the 
platform supports it.

> Then please:
>
> NO C STYLE CASTS, NOWHERE. READ AND UNDERSTAND CASTS IN C++ (Denys will
> agree with me that C-style casts actually put Mozart in big shit, I won't
> have that again).

Ok, we'll go through the code and get rid of them.

> NO FUNKY LAYOUT! Fact is, do it as I did it (I know that's tough luck, but
> such is life).

What layout are you referring to? Directory structure or coding conventions? 
I'm sure we'll have to work on both...

Guido

-- 
Guido Tack
Programming Systems Lab
http://www.ps.uni-sb.de/~tack



More information about the gecode-users mailing list