Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 2002 17:34:27 -0700 (MST)
From:      "Terry R. Friedrichsen" <terry@uplift.sunquest.com>
To:        jonc@chen.org.nz, questions@FreeBSD.ORG
Subject:   re:  printf(3) problem?
Message-ID:  <200205180034.RAA53968@uplift.sunquest.com>

next in thread | raw e-mail | index | archive | help

> Sigh. On a second review, the problem here is that you're supplying
> an "int" sized value when the format string expects a "long" sized
> value.

I perceive.  More precisely, I'm supplying a "long long" value (off_t),
when the format string expects a "long" value.

Blame FreeBSD/AXP, where this code originally came from.

And yes, I was too stupid to tell cc to do "-Wall" ...

I can see that the printf() statement in the real code this example came
from is gonna turn into an #ifdef farm.  It'd be rather nice if the C pre-
processor could do "sizeof" in #if conditionals ... but of course it can't.

It may be best to generate the format string at run-time.

Thanks to all who replied.

Terry R. Friedrichsen

terry@uplift.sunquest.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205180034.RAA53968>