From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CF7A11A1E0B for ; Tue, 27 Sep 2016 13:10:54 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP; 27 Sep 2016 13:10:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,406,1470726000"; d="scan'208";a="13949122" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by orsmga005.jf.intel.com with ESMTP; 27 Sep 2016 13:10:54 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.161]) by ORSMSX103.amr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0248.002; Tue, 27 Sep 2016 13:10:54 -0700 From: "Kinney, Michael D" To: "Cohen, Eugene" , "afish@apple.com" , "Kinney, Michael D" CC: Alexei Fedorov , "edk2-devel@lists.01.org" , Laszlo Ersek Thread-Topic: [edk2] What is the right way to print a UINTN? Thread-Index: AdIX/FZUkJ+/GDfSRZe7u7ShyrQtxgASWdEAACvtKYAABDdLAAADQGEAAAGJsAAADkOVQP//uvkAgABrYfA= Date: Tue, 27 Sep 2016 20:10:53 +0000 Message-ID: References: <0de4dd03-faa7-1608-9625-369ab5d6e682@redhat.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTdiM2I0MmYtZTJiNC00NzI5LWEwNzItZWIzMjk1ZTkwZDNiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlYrRXRHb0F0Qk43OGo4ZldlZnZSQ3RMRGtNSndyNEVEOEE3SkVGZVFlT2s9In0= x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: What is the right way to print a UINTN? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2016 20:10:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Eugene, I agree. There are use cases for using UINTN so values can scale to CPU ar= ch. Casting those specific use cases from UINTN to UINT64 when used in a print = call=20 is likely the safest method. There are many use case of UINTN where the value is limited to 32-bits, and a typecast is not required. The format specifier idea is interesting. I need to lookup the ANSI C vers= ions of those. Looks like they were introduced in C99. Mike > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Co= hen, Eugene > Sent: Tuesday, September 27, 2016 12:29 PM > To: Kinney, Michael D ; afish@apple.com > Cc: Alexei Fedorov ; edk2-devel@lists.01.org devel@ml01.01.org>; Laszlo Ersek > Subject: Re: [edk2] What is the right way to print a UINTN? >=20 > MIke, >=20 > > Portable sources that use type UINTN must never use values larger > > than > > 32-bits. Same for type INTN. Only use values in signed 32-bit range. >=20 > If the value is something like an enumeration or bitmask then I agree, bu= t not if it's > something numeric that is supposed to scale to larger numbers on 64-bit p= latforms like > the Length field of CopyMem. >=20 > I like the proposals to use a custom format specifier (although the conca= tenated string > with macro will take some getting used to). >=20 > Thanks, >=20 > Eugene > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel