Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site cca.UUCP Path: utzoo!linus!decvax!cca!dewitt From: dewitt@cca.UUCP (Mark DeWitt) Newsgroups: net.lang.c Subject: questions from using lint Message-ID: <7097@cca.UUCP> Date: Tue, 8-Apr-86 19:12:13 EST Article-I.D.: cca.7097 Posted: Tue Apr 8 19:12:13 1986 Date-Received: Fri, 11-Apr-86 20:39:55 EST Organization: Computer Corp. of America, Cambridge Lines: 52 *** REPLACE THIS LINE WITH YOUR MESSAGE *** I have three questions, the first of which was only brought to my attention by lint, not caused by it. The code in question works under BSD4.2 on both vaxes and suns. 1. I have code with declarations that look like the following: struct tm *zulu, *gmtime(); but I forgot to #include at the top. Pretty careless, but what is remarkable is that I never noticed until I ran lint on it. WHY DID THIS COMPILE SUCCESSFULLY? The only other headers I included were ctype.h and stdio.h, neither of which includes anything else. The lint message was: warning: structure tm never defined 2. With the following code-- static int page; ioctl(0, SOMEINTEGER, (char *)&page); or ioctl(0, SOMEINTEGER, (char *)(&page)); lint says: warning: illegal pointer combination. This doesn't make sense to me. For one thing, ioctl's arguments are defined in the manual as: ioctl(int d, int request, char *argp) For another thing, the C Reference Manual says (Section 14.4): "It is guaranteed that a pointer to an object of a given size may be converted to a pointer to an object of smaller size and back again without change." So why can't I cast the address of a static integer into a pointer to a character? If I don't cast all such arguments of disparate types to char *'s then lint complains about "arg n not declared consistently" or something like that. 3. How do you get lint to shut up about variable numbers of arguments with stdio functions like printf, scanf, etc.? I tried using /*VARARGS*/ right, left, and sideways to no avail. The doc is not great, but you knew that already. After three years of C programming I'm just starting to use lint, so please no negative reinforcement by flaming about how stupid my questions are, lest I give up on it entirely :-). -- "We like your attitude, but what are you doing?"