I tried to overload the function using the C11 macro _Genericas follows:
_Generic
int isPrim_int (int num); int isPrim_lint (long int num); int isPrim_llint (long long int num); #define isPrim(_1, ...) _Generic((_1), \ int: isPrim_int, \ long int: isPrim_lint, \ long long int: isPrim_llint)
But for some reason, use isPrim()always returns 1 when using certain three functions isPrim_int, isPrim_lintand isPrim_llintit works as intended. Any clues what is wrong with my use of the macro?
isPrim()
isPrim_int
isPrim_lint
isPrim_llint
Thank you so much!
"", , , , , "" , . _Generic , "" .
() _Generic . .
()
#define isPrim(_1, ...) _Generic((_1), \ int: isPrim_int, \ long int: isPrim_lint, \ long long int: isPrim_llint)(_1)
,
int a = 42; if (isPrim(a)(a)) ...
, , , .
Source: https://habr.com/ru/post/1689095/More articles:Custom subset of data. - rHow can I get multiple Java regex matches only on specific lines - javaЕсть ли функция lodash или "lodash way" для выполнения условного _.map? - javascriptRebol: dynamic linking of block words - rebolHow does Twitter extract meaningful colors of objects from image pixel data? - cssnumpy, getting a min or max element of three elements - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1689097/accesstoken-same-as-idtoken-when-trying-to-acquire-access-token-with-adaljs-authenticationcontext&usg=ALkJrhiOTvORBCVwXGBgpZ1cPJ40KKz1rAInsert 1000+ nodes and attributes using XMLStarlet - Run slowly - unixcv2.imshow placing an image window outside the visible screen - pythonHow to convert char to ascii value in kotlin language - androidAll Articles