List:Internals« Previous MessageNext Message »
From:Tor Didriksen Date:July 8 2009 10:35am
Subject:Re: Not entering the loop - per query variables
View as plain text  
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
>


Thread
Not entering the loop - per query variablesJoseph Lukas7 Jul
  • Re: Not entering the loop - per query variablesSergei Golubchik7 Jul
    • Re: Not entering the loop - per query variablesJoerg Bruehe8 Jul
      • Re: Not entering the loop - per query variablesTor Didriksen8 Jul