Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!sjsca4!konath From: konath@sj.ate.slb.com (Kannan Konath) Newsgroups: comp.lang.c Subject: Re: strncpy Message-ID: <1990Jan3.150711.22088@sj.ate.slb.com> Date: 3 Jan 90 15:07:11 GMT Reply-To: konath@vonneumann.UUCP (Kannan Konath) Organization: Schlumberger ATE, San Jose, CA Lines: 26 I had asked this question, around two weeks ago. I received a good number of answers by email. Thanks for the replies. I had also promised to post a summary. Well here goes.... The question was: Why does the C compiler not come up with an error when a function, say foo, of zero arguments gets called in the following manner. foo; /* the parentheses are missing */ Answer: I did not know it at that time, but the above statement "foo;" just generates the address of the function foo. Since expressions are allowed to stand all by themselves in C, this passes and rightly so. In fact this statement in particular has a null effect, though in my opinion expressions without any side effect should generate warnings but then I suppose C's philosophy lies behind this lack of warnings even in cases like this. To detect these sort of errors, lint can be used. In particular if you are working on a BSD Unix system you need to use the "-h" flag which points this error out.