unsigned long的一点应用

来源:互联网 发布:me域名多少钱 编辑:程序博客网 时间:2024/05/29 17:21
#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;}

0 0
原创粉丝点击