Xref: utzoo comp.lang.c:22135 comp.unix.ultrix:1757 Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!psueea!parsely!bucket!servio!penneyj From: penneyj@servio.UUCP (D. Jason Penney) Newsgroups: comp.lang.c,comp.unix.ultrix Subject: Type of expression sizeof(x) Summary: (DECStation 3100 bug) Is it Unsigned? Message-ID: <256@servio.UUCP> Date: 19 Sep 89 21:28:06 GMT Reply-To: penneyj@servio.UUCP (D. Jason Penney) Organization: Servio Logic Development Corp.; Beaverton, OR Lines: 29 Consider the following simple program? #include main() { if (3 - sizeof(long) < 0) printf("passed\n"); else printf("failed\n"); } On our DECStation-3100 running Ultrix, this program returns "failed" instead of "passed". It seems that the sizeof() is promoting the expression to be unsigned. By the way, changing 3 to 3L does NOT make the problem disappear. I am posting this quirk to comp.lang.c because I would be VERY interested to hear (by e-mail, please) from anyone who thinks that this is acceptable behavior. I am posting this to comp.unix.ultrix because I think you poor implementors ought to be forewarned. Our conversation with DEC re this bug was extremely unhelpful. They claim that the return type of a sizeof() expression is system-dependent. -- D. Jason Penney Ph: (503) 629-8383 Beaverton, OR 97006 uucp: ...uunet!servio!penneyj STANDARD DISCLAIMER: Should I or my opinions be caught or killed, the company will disavow any knowledge of my actions...