Has TRUE always had a non-zero value?

前端 未结 22 1042
予麋鹿
予麋鹿 2020-12-31 01:38

I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I\'ve worked with, if you could even

22条回答
  •  无人及你
    2020-12-31 01:58

    I worked at a company with a large amount of old C code. Some of the shared headers defined their own values for TRUE and FALSE, and some did indeed have TRUE as 0 and FALSE as 1. This led to "truth wars":

    /* like my constants better */
    #undef TRUE
    #define TRUE 1
    
    #undef FALSE
    #define FALSE 0
    

提交回复
热议问题