List:MySQL++« Previous MessageNext Message »
From:Jonathan Wakely Date:May 13 2008 8:38pm
Subject:Re: Build issue, v3.0.3, gcc 4.3, x86_64 (with patch proposal)
View as plain text  
2008/5/13 Remi Collet :
>
>  This is probably because unsigned int is 32 bits while size_t is 64 bits.

It's because std::max() is a template and the argument types must
match in order to deduce the template argument.  It's not strictly to
do with the size of the types, just the identity of the types, so it's
more likely that on 32bit systems size_t is a typedef for unsigned
int, but on 64bit it's a typedef for unsigned long.

>  Here is a little/trivial patch,
>  but this is probably not the better solution :

for completeness' sake, the other option would have been to state
which max specialisation you want:
  unsigned int ui = 2;
  size_t s = 3;
  max<size_t>(ui, s);   // OK

there's no need to deduce the template argument here, so both args are
converted implicitly to size_t.

Jon
Thread
Build issue, v3.0.3, gcc 4.3, x86_64 (with patch proposal)Remi Collet13 May
  • Re: Build issue, v3.0.3, gcc 4.3, x86_64 (with patch proposal)Warren Young13 May
    • Re: Build issue, v3.0.3, gcc 4.3, x86_64 (with patch proposal)Remi Collet13 May
  • Re: Build issue, v3.0.3, gcc 4.3, x86_64 (with patch proposal)Jonathan Wakely13 May
    • Re: Build issue, v3.0.3, gcc 4.3, x86_64 (with patch proposal)Warren Young13 May