From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23659 invoked by alias); 17 Oct 2018 12:05:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 23643 invoked by uid 89); 17 Oct 2018 12:05:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Wed, 17 Oct 2018 12:18:00 -0000 From: Joseph Myers To: Albert ARIBAUD CC: Subject: Re: [PATCH] Y2038: add struct __timespec64 In-Reply-To: <20181017120011.1c946925@athena> Message-ID: References: <20180919072701.27535-1-albert.aribaud@3adev.fr> <20180926132408.7b64cb08@athena> <20181017120011.1c946925@athena> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2018-10/txt/msg00292.txt.bz2 On Wed, 17 Oct 2018, Albert ARIBAUD wrote: > > In that case, is there any reason for the contents of the internal type to > > differ at all from the contents of the public type? Or would it be best > > for both to use the anonymous padding when building for 32-bit long? > > The only reason for a difference between an internal (64-bit tv_nsec) > and public (32-bit tv_nsec) type is that we want application source code > to build and run the same for 32-bit and 64-bit time, and Posix defines > tv_nsec as a long (for 32-bit time), so application source code /might/ > expect it to be a long for 64-bit time too. However, the worse I can > foresee if we make tv_nsec 64-bit is that some application source code > might copy it into a long, which /may/ trigger gcc to warn if the > compiler options include -Wconversion. I agree that the user-visible type should be long in all cases. My question was why the internal tv_nsec should be 64-bit for the case of 32-bit long, rather than making the internal type work the same as the POSIX one (long tv_nsec, anonymous padding when needed), if there is never any need to zero the padding explicitly. -- Joseph S. Myers joseph@codesourcery.com