Inlining function pointers
yavuz yetim
yavuzyetim@hotmail.com
Wed Aug 26 14:38:00 GMT 2009
Hi,
I am using GTree in GLib and the g_tree_foreach() -shown below- function takes a function pointer to call a function (say comp()) for each node while traversing the tree.
If I declare the function to be inlined and compile it, gcc comlains with following message:
/var/folders/eh/ehsWlP8bFe8W4KcsmZuVyk+++TI/-Tmp-//ccXexCH9.s:2592:non-relocatable subtraction expression, "_str_print" minus "L00000000006$pb"
/var/folders/eh/ehsWlP8bFe8W4KcsmZuVyk+++TI/-Tmp-//ccXexCH9.s:2592:symbol: "_str_print" can't be undefined in a subtraction expression
somewhere in main:: g_tree_foreach(my_tree, comp, NULL);
functions::
inline gboolean comp(/*arguments*/) { /*do stuff*/ return FALSE;}
/*g_tree_foreach From GLib source*/void g_tree_foreach (GTree *tree, GTraverseFunc func, gpointer user_data){ GTreeNode *node;
g_return_if_fail (tree != NULL); if (!tree->root) return;
node = g_tree_first_node (tree); while (node) { if ((*func) (node->key, node->value, user_data)) break; node = g_tree_node_next (node); }}
Thanks,Yavuz
_________________________________________________________________
Hotmail® is up to 70% faster. Now good news travels really fast.
http://windowslive.com/online/hotmail?ocid=PID23391::T:WLMTAGL:ON:WL:en-US:WM_HYGN_faster:082009
More information about the Gcc-help
mailing list