Hi, i am trying to compile Curl with cparser[0], but it breaks, because of some invalid C code. The problem is in typecheck-gcc.h:
#define _curl_is_any_ptr(expr) (sizeof(expr) == sizeof(void*)) Sometimes expr is a function type. E.g. this line from the git source: curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite); The gcc behavior deviates from the ANSI C Standard. * ANSI: The sizeof operator shall not be applied to an expression that has function type * GCC: returns 1 A return value of 1 is arbitrary and should not be relied on. The _curl_is_any_ptr macro is broken in multiple ways. For example, it also evaluates to true, if expr is int, on most architectures. So i think the macro does not work as intended. A counter-argument would be that is ok that typecheck-gcc.h relies on implementation-specific gcc behavior, but non-portable code should be avoided. cheers -- Andreas Zwinkau Karlsruhe Institute of Technology (KIT) Institut für Programmstrukturen und Datenorganisation (IPD) Lehrstuhl Prof. Snelting Adenauerring 20a 76131 Karlsruhe Phone: +49 721 608-4-8351 Fax: +49 721 608-4-8457 Email: [email protected] Web: http://pp.info.uni-karlsruhe.de/person.php?id=107 KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
