On Wed, 08 Jul 2009 11:24:48 +0200, Joerg Bruehe <Joerg.Bruehe@stripped>
wrote:
> Hi Joseph, all!
>
>
> Sergei Golubchik wrote:
>> Hi, Joseph!
>>
>> On Jul 07, Joseph Lukas wrote:
>>> I am having an issues getting through my loop for the List.
>>>
>>> int sql_statement_set(THD *thd, List<set_var_base> *var_list){
>>>
>>> List_iterator_fast<set_var_base> it(*var_list);
>>> DBUG_ENTER("sql_set_variables");
>>> int count = 0;
>>> set_var_base *var;
>>> while ((var=it++))
>>> {
>>> count++;
>>> printf("I looped");
>>> }
>>> printf("The number of objects is: %d \n",count);
>>> return 0;
>>
>> if you use DBUG_ENTER() you need to use DBUG_RETURN (or
>> DBUG_VOID_RETURN) - these always should be paired.
>
> Also, you should have the declarations of all variables *before* the
> DBUG_ENTER(), because this macro will (when doing a debug build) expand
> to an executable statement.
> There are compilers that consider a variable declaration after an
> executable statement to be a syntax error, so your current code sequence
> is not fully portable.
>
For C yes. This seems to be C++ and I would think all compilers support it.
-- didrik
>>
>>> }
>>>
>>> [[...]]
>
> Regards,
> Jörg
>