objective c - What does the “Ordered comparison of function pointers” warning mean? -
i got compiler warning:
ordered comparison of function pointers ('imp' (aka 'id(*)(id,sel,...)')and "imp") when try compare 2 entity:
for (i = 0; k < 30; k++) { imp imp = getvalue(class_method[i]); if (imp <= (imp)currdesc->address) {//this line causing warning size_t diff = (size_t)classmap->address - (size_t)imp; if (diff < mediumsize) { best_method = class_method[i]; is_class_method = yes; mediumsize = diff; } } can please explain me eventual cause of warning , how fix it.
in direct answer question, ordered comparison of function pointer warning generated when try compare addresses of 2 function pointers. in cases, comparison erroneous because there little value in comparing location of 2 functions in memory.
that may or may not case here, if need have function pointers directly comparable, need either explicitly turn off warning (i couldn't find compiler option this, if there one) or cast 2 pointers values support comparison, such void*.
Comments
Post a Comment