List:Internals« Previous MessageNext Message »
From:Joerg Bruehe Date:July 8 2009 9:24am
Subject:Re: Not entering the loop - per query variables
View as plain text  
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.

> 
>> }
>>
>> [[...]]

Regards,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  Joerg.Bruehe@stripped
Sun Microsystems GmbH,   Komturstraße 18a,   D-12099 Berlin
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

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