Cautions with g_list_next()



Hi pals,

Are there any known recomendations about GLists and the g_list_next() macro? I found no remarks in the official documentation until I got problems with constructions like this...

        element = g_list_first (member->names);
        while (element) {
                ...
                element = g_list_next (member->names);
        }

... which led the program to an infinite loop because "element" would NOT acquire the 0x0 (NULL) value from "element->next" as expected. I could deduce that this is a problem concerning the macro nature and pre-processing of g_list_next, as the K&R "bible" book warns. The same construction seems to work fine if the iteration line is "element = g_list_next (element)" or "element = element->next". Have you ever had problems like this, or have I missed something?

Regards!

Fabricio Rocha
Brasilia, Brasil

        

        
                
_______________________________________________________ Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas !
http://br.answers.yahoo.com/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]