From owner-freebsd-questions@FreeBSD.ORG Wed Jan 16 18:21:09 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 98EEAF62 for ; Wed, 16 Jan 2013 18:21:09 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: from mail-oa0-f41.google.com (mail-oa0-f41.google.com [209.85.219.41]) by mx1.freebsd.org (Postfix) with ESMTP id 6A54B7F for ; Wed, 16 Jan 2013 18:21:09 +0000 (UTC) Received: by mail-oa0-f41.google.com with SMTP id k14so1761916oag.14 for ; Wed, 16 Jan 2013 10:21:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=BfP4ecxnviqQ05dYU2tYyAHcBRMtda9qPo72q5WUrf8=; b=c+FveJVqIxnVxb7OaNIOeZRJIrZWIhRBWiSFSc5UNN+Z19TRHSRYj5lM2GUV0gsYeq yxdR8YWQWBX9wZwpCBzpGPxeJMO6VhK1Y1Jrtqnqhjz6ZbHyiZO80YiyLCwb0rx3fUI1 9t30ckj3jhTRQjeb0yTn4p9NIn+JXeAxA38QGndmz06VyXwZI89mXiYicWqfXkXmV6gm vY6r3HcDpkI7fd0oB0KJJ+4mcgAG37pIs9bGzaLAoi1yEt77+3T0D/WXhfLjBoq7GmTR DIl/mqV5Z38OkXGhl5Oo4xESBf3cZXZvZ80VEhS8Uw+5Q7G/1i2Y/+YFe/RAIddD9ZKK D7xg== MIME-Version: 1.0 X-Received: by 10.182.149.106 with SMTP id tz10mr1679456obb.13.1358360463487; Wed, 16 Jan 2013 10:21:03 -0800 (PST) Received: by 10.60.119.9 with HTTP; Wed, 16 Jan 2013 10:21:03 -0800 (PST) In-Reply-To: <50F6EDFB.70501@speakeasy.org> References: <50F5A189.7000701@speakeasy.org> <20130116120015.3b8d0db4@mr129166> <50F6EDFB.70501@speakeasy.org> Date: Wed, 16 Jan 2013 10:21:03 -0800 Message-ID: Subject: Re: time_t definition From: Michael Sierchio To: "Thomas D. Dean" Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmHw6JfBgAdLEQWb7jUtt6wz798BnesAUKajNgGwmhQWmIKFy2DXgWGBCgkGDG3WKgkKIi2 Cc: "questions@FreeBSD.org" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 18:21:09 -0000 Top posting for brevity - the fact is, the code in your original example is wrong. There are reasons to complain about argument size mismatches, esp. in print functions that call (versions of) malloc. You should cast the time_t value explicitly, or use %d instead of %ld. - M On Wed, Jan 16, 2013 at 10:14 AM, Thomas D. Dean wrote: > On 01/16/13 03:00, Patrick Lamaiziere wrote: > >> Looks like gcc47 checks the printf format string (-Wformat) >> Disable this check or convert your time_t. > > > Yes, I know gcc47 checks the format string. > > But, time_t is of type int32, from a typedef statement. > > > #include > typedef int zzz; > typedef zzz yyy; > typedef yyy xxx; > int main() { > xxx idx; > for (idx=0; idx<10; idx++) printf("%d\n",idx); > return 0; > } > > does not produce the error (I did this on the 'other' system) >> gcc --version > gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 > ... > >> gcc -O2 -pipe -I../../include -std=gnu99 -fstack-protector >> -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized >> -Wno-pointer-sign xxx.c -o xxx > > I did not think to do this on the FreeBSD system I was using yesterday. > > What I don't understand is where gcc is losing track of this definition. > > In 9.0, or maybe earlier, the definition of time_t was changed with a view > toward 64-bit systems. I remember a statement to the effect of "in 2038, > 32-bit time will overflow. It is unlikely that many 32-biot systems will be > around then. So, making the change to 64-bit now will prevent having to do > it in the future". > > So, now, it seems that any calculation involving time_t requires a cast???? > > Tom Dean > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"