Romulo Goncalves wrote:
Sjoerd Mullender wrote:
Update of /cvsroot/monetdb/MonetDB5/src/mal In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19189
Modified Files: mal_recycle.mx Log Message: Fix types: getVolume returns a size_t, so there is absolutely no need to convert back and forth to lng. Also use correct format specifiers and the correct number of format specifiers. With this change I will get compilation complains: cc1: warnings being treated as errors /ufs/goncalve/MonetDB/current/MonetDB5/src/mal/mal_recycle.mx: In function 'RECYCLEnew': /ufs/goncalve/MonetDB/current/MonetDB5/src/mal/mal_recycle.mx:692: warning: comparison between signed and unsigned
due this if clause: memLimit = recycleMemory?recycleMemory:HARDLIMIT_MEM; if ( recyclerUsedMemory + (lng) wr > memLimit) return ; /* no more caching */
If I do a cast to lng if ( recyclerUsedMemory + (lng) wr > memLimit)
The compilation starts to work.
Should I do the cast or is something else that I forgot to do?
You can do that. The Right Thing To Do would be to use the correct types for everything. In this case, size_t for anything that counts bytes (such as recyclerUsedMemory and memLimit).
Romulo
U mal_recycle.mx Index: mal_recycle.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v retrieving revision 1.127 retrieving revision 1.128 diff -u -d -r1.127 -r1.128 --- mal_recycle.mx 30 Jul 2008 13:53:03 -0000 1.127 +++ mal_recycle.mx 31 Jul 2008 08:27:31 -0000 1.128 @@ -676,7 +676,7 @@ }
static void -RECYCLEnew(Client cntxt, MalBlkPtr mb, MalStkPtr s, InstrPtr p, lng rd, lng wr) +RECYCLEnew(Client cntxt, MalBlkPtr mb, MalStkPtr s, InstrPtr p, size_t rd, size_t wr) { int i, j, c; ValRecord *v; @@ -1027,8 +1027,8 @@ RECYCLEexitImpl(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){ lng clk = 0; lng memLimit, cacheLimit; - lng rd = getVolume(stk,p, 1)/ RU +1; - lng wr = getVolume(stk,p, 0)/ RU +1; + size_t rd = getVolume(stk,p, 1)/ RU +1; + size_t wr = getVolume(stk,p, 0)/ RU +1; ValRecord *v;
RECYCLEversion(cntxt,mb); @@ -1072,7 +1072,7 @@ if (rd+wr > recycleVolume){ (void) RECYCLEnew(cntxt,mb, stk, p, rd, wr); #ifdef _DEBUG_RECYCLE_ - stream_printf(cntxt->fdout,"RECYCLEexit size %d %d\n",rd,wr); + stream_printf(cntxt->fdout,"RECYCLEexit size " SZFMT " " SZFMT "\n",rd,wr); #endif } } @@ -1085,8 +1085,8 @@ if (recycleAlpha *(rd+wr) + (1-recycleAlpha)* clk > (recycleVolume+1) * (recycleTime+1)){ (void) RECYCLEnew(cntxt,mb, stk, p, rd, wr); #ifdef _DEBUG_RECYCLE_ - stream_printf(cntxt->fdout,"RECYCLEexit volume %d %d %d \n",clk,rd,wr,(rd+wr)*clk); - stream_printf(cntxt->fdout,"RECYCLEexit volume %d %d\n", recycleVolume, recycleTime); + stream_printf(cntxt->fdout,"RECYCLEexit volume " LLFMT " " SZFMT " " SZFMT " " LLFMT " \n",clk,rd,wr,(rd+wr)*clk); + stream_printf(cntxt->fdout,"RECYCLEexit volume " LLFMT " " LLFMT "\n", recycleVolume, recycleTime); #endif } }
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
-- Sjoerd Mullender