wtf?
От: e113c08d6cf14afb  
Дата: 07.05.11 00:16
Оценка:
#include <stdio.h>
#include <boost/typeof/typeof.hpp>

template<class T>
struct __macro
{
    __declspec(thread) static T _;
};

template<class T>
T __macro<T>::_;

#define def(c) (__macro<typeof(c)>::_ = c)
#define acc(c) (__macro<typeof(c)>::_)

#define is_digit(x) (def(x),(acc(x) >= '0' && acc(x) <= '9') ? true : false)
#define is_bugit(x) ((x >= '0' && x <= '9') ? true : false)

int main()
{
    char hj;
    
    hj = '9';
    printf("test->") && is_bugit(hj++) && printf("ok\n") || puts("no");

    hj = '9';
    printf("test->") && is_digit(hj++) && printf("ok\n") || puts("no");
}
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.