Sjoerd Mullender wrote:
> Fabian wrote:
>> Update of /cvsroot/monetdb/MonetDB5/src/mal
>> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12770/mal
>>
>> Modified Files:
>>      mal_box.mx 
>> Log Message:
>> insertToBox copies its 2nd and 3rd arguments, so it can declare them as
>> const.  Nevertheless we still need a cast, because char * != str.
>>
>>
>> Index: mal_box.mx
>> ===================================================================
>> RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_box.mx,v
>> retrieving revision 1.78
>> retrieving revision 1.79
>> diff -u -d -r1.78 -r1.79
>> --- mal_box.mx       12 Jun 2007 17:21:17 -0000      1.78
>> +++ mal_box.mx       16 Jul 2007 12:45:25 -0000      1.79
>> @@ -226,7 +226,7 @@
>>  mal_export int releaseAllBox(Box box);
>>  
>>  mal_export int depositBox(Box box, str name, ValPtr val);
>> -mal_export void insertToBox(Box box, str name, str val);
>> +mal_export void insertToBox(Box box, const str name, const str val);
>>  mal_export int takeBox(Box box, str name, ValPtr val, int tpe);
>>  mal_export int bindBAT(Box box, str name, str location);
>>  mal_export int releaseBox(Box box, str name);
>> @@ -418,7 +418,7 @@
>>  }
>>  
>>  void
>> -insertToBox(Box box, str nme, str val)
>> +insertToBox(Box box, const str nme, const str val)
>>  {
>>      ValRecord vr;
>>  
>>
>>
> 
> This is actually pretty useless.  You've declared val as a const, not
> what val point to (i.e. the chars that make up the string).
> Consider this:
> 
> typedef char *str;
> void foo(const str x)
> {
>       *x = 0;
> }
> 
> this is valid code and will be accepted by both gcc and icc, but this is
> exactly what you try to prevent from happening when you declare a
> parameter const char *.  In other words, val should be declared as const
> char *val, and then you shouldn't need the case when calling the function.

s/case/cast/

> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Monetdb-checkins mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins


-- 
Sjoerd Mullender

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to