CnUnix

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ CnUnix ] in KIDS
글 쓴 이(By): Nameless (One)
날 짜 (Date): 2006년 4월 11일 화요일 오전 02시 19분 32초
제 목(Title): Re: [Q] 둘다 0 이거나 둘다 아니거나..



 C기준으로.
 if( !f() ^ a )

------
 c를 기준으로
 !0 == 1 을 보장하지 않는데요?
 대부분의 c compiler 는 !0 을 1로 처리하긴 하지만요.
------ 

http://anubis.dkuug.dk/JTC1/SC22/WG14/www/docs/n869/n869.txt.gz 에 따르면
       [#5] The result of the logical negation operator ! is  0  if
       the  value  of  its  operand compares unequal to 0, 1 if the
       value of its operand compares equal to 0.   The  result  has
       type int.  The expression !E is equivalent to (0==E).
http://www-ccs.ucsd.edu/c/express.html#Logical%20NOT 또한
!X 
You write !X to test whether X is zero. If X is zero, the value of the 
expression is 1; otherwise, the value is zero.
라고하므로... 처음께 정답 맞지 싶은데..

심심한김에 하나 더하면.. 
if( f()*a || !f()*!a)
[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.