Has TRUE always had a non-zero value?

前端 未结 22 1045
予麋鹿
予麋鹿 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 02:01

    General rule:

    1. Shells (DOS included) use "0" as "No Error"... not necessarily true.

    2. Programming languages use non-zero to denote true.

    That said, if you're in a language which lets your define TRUE of FALSE, define it and always use the constants.

提交回复
热议问题