Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: goto's and switch statements -- mild proposal Message-ID: <8394@mimsy.UUCP> Date: Thu, 3-Sep-87 21:35:34 EDT Article-I.D.: mimsy.8394 Posted: Thu Sep 3 21:35:34 1987 Date-Received: Sat, 5-Sep-87 13:45:19 EDT References: <855@tjalk.cs.vu.nl> <2683@hoptoad.uucp> <916@haddock.ISC.COM> <712@spar.SPAR.SLB.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 33 In article <712@spar.SPAR.SLB.COM> hunt@spar.SPAR.SLB.COM (Neil Hunt) writes [concerning `possible pointer alignment problem' warnings from lint on such code as `p = (int *)malloc(...);']: >I don't know which compiler you are using, but on the compiler I use, >this warning is avoided if you make sure that the compiler knows that >malloc returns a pointer by declaring it (char *). Try `lint -h'; plain `lint' does not complain under 4BSD, but -h is useful for other things. It might be reasonable to add an /*ALIGNOK*/ or /*ALIGNED*/ pragma; that seems to me better than making lint assume that all `void *' functions return aligned pointers. >>BTW. Does anybody know how to stop lint complaining about functions >>returning values wich are always/sometimes ignored? >Tell lint explicitly that you know that a value is returned, but you >are discarding it by calling the function with a (void) cast: Again, another pragma would be useful: /*DULLVALUE*/ could indicate that the return value from a function need not be used. strcpy and strcat should be declared dull, but fclose should not, for it tells whether an error occurred during closing. > char *sprintf(); Please do not declare sprintf `char *' if you can avoid it. It will soon be `int', if it is not already `int' on your machine. For this reason I put a declaration in my new ; it presently reads `char *' but will presently read `int'. (The double meaning of presently is a moot :-) point, but not one we should discuss here.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris