renatoGarcia / icecream-cpp

🍦 Never use cout/printf to debug again
Other
577 stars 29 forks source link

cannot display char as integer #33

Open logerrors opened 2 years ago

logerrors commented 2 years ago

CleanShot 2022-09-03 at 10 51 31@2x

#include <algorithm>
#include <numeric> 

#include "icecream.hpp"

using namespace std;

#define DETECT_TYPE(x)                        \
    do                                        \
    {                                         \
        IC(sizeof(x));                        \
        IC_("d", std::numeric_limits<x>::max());    \
        IC_("d", std::numeric_limits<x>::min());    \
        IC_("d", std::numeric_limits<x>::lowest()); \
    } while (0)

int main(int argc, char **argv)
{
    DETECT_TYPE(char);
    DETECT_TYPE(unsigned char);
    return 0;
}

expect: it should display max: 128, min: -127, lowest: -127 gcc 11.2 linux