您的位置:首页 > 其它

unsigned long的一点应用

2016-06-28 20:52 363 查看
#include<stdio.h>
int main() {
    typedef unsigned long priority_type;

    static const priority_type LOWEST_PRIORITY = ~0UL;    //0为unsinged long类型,并且每位取反,下同。试下~,把%lu改为%ld再试下~
    static const priority_type LOW_PRIORITY = 1UL << 24;
    static const priority_type NORMAL_PRIORITY = 1UL << 16;
    static const priority_type HIGH_PRIORITY = 1UL << 8;
    static const priority_type HIGHEST_PRIORITY = 0;

    printf("LOWEST_PRIORITY=%lu, LOW_PRIORITY=%lu, NORMAL_PRIORITY=%lu, HIGH_PRIORITY=%lu, HIGHEST_PRIORITY=%lu\n",
            LOWEST_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, HIGH_PRIORITY, HIGHEST_PRIORITY);
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: