lint won't verify printf formatting against variable types??

Goran Larsson [Hacker of Hackefors] hacker at isadora.ikp.liu.se
Fri Jun 30 16:51:44 AEST 1989


In article <115 at borabora.omni.com> bob at omni.com (Bob Weissman) writes:
>I'm talking about
>	if (expression);
>which, while legal, *never* makes sense semantically, as it is always
>equivalent to
>	expression;
>
>OK?

NO, NO, NO, NO!

It does make sense sometimes, take this for example:

#define WATCHDOG {if (*( (char *)0x80007 ));}

Whenever you use this macro it will be compiled as "tstb 0x80007" (68k)
wich is the smallest and fastest way of kicking the watchdog without side
effects (assignment to dummy variable etc.)

Talking about equivalence, I cant see that
	if (*( (char *)0x80007 ));
is equivelant to
	*( (char *)0x80007 );
as the later does not generate any code at all!

  !       _
  ! !    Goran Larsson  [The Hacker of Hackefors]
--+-!    Hackefors, Linkoping, SWEDEN (See)  +46 13-155535 (Hear)
  !-+--  ...!uunet!sunic!liuida!prodix!isadora!hacker (UUCP)
  ! !    hacker at isadora.ikp.liu.se (Internet)     _
    !    This signature is Cosylight (C) 1989 by Goran Larsson



More information about the Comp.lang.c mailing list