public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Richard Damon <Richard@damon-family.org>
To: newlib@sourceware.org
Subject: Re: [EXTERNAL]: Re: Why int32_t is long int on 32 Bit Intel?
Date: Fri, 28 Jul 2023 13:06:23 -0400	[thread overview]
Message-ID: <5F615A8B-DB01-4824-9486-4AD146D6B991@damon-family.org> (raw)
In-Reply-To: <MN2PR13MB45107971DE948A2BCA2BF9CDC406A@MN2PR13MB4510.namprd13.prod.outlook.com>

Actually, it is showing you are using the “wrong” format. If you are printing an int32_t, you should be using the format out of inttypes.h to be correct, even if it is “ugly”.

> On Jul 28, 2023, at 12:27 PM, Mike Burgess <Mike.Burgess@coherent.com> wrote:
> 
> Stefan, I was referring to %zu. But, when the argument is int32_t, one needs to correctly pick %d or %ld to avoid a senseless warning. Or, always use %ld and—safely and without penalty—cast the argument to long. But I dislike cluttering my code with casts that might hide future defects. (Let's not have an argument about using printf at all, as this is far beyond the scope of the original question.)
> 
> <inttypes.h> I guess does have definitions that _might_ solve this, but they are awkward and by experience don’t always exist.
> 
> Mike
> 
> 
> ________________________________
> From: Newlib <newlib-bounces+mburgess=ii-vi.com@sourceware.org> on behalf of Stefan Tauner <stefan.tauner@gmx.at>
> Sent: Friday, July 28, 2023 12:11 PM
> To: newlib@sourceware.org <newlib@sourceware.org>
> Subject: Re: [EXTERNAL]: Re: Why int32_t is long int on 32 Bit Intel?
> 
>> On Fri, 28 Jul 2023 15:49:25 +0000
>> Mike Burgess <Mike.Burgess@coherent.com> wrote:
>> 
>> Printf has a pretty good solution for size_t nowadays, but not so much for int32_t.
> 
> It does. inttypes.h
> 
> --
> Kind regards/Mit freundlichen Grüßen, Stefan Tauner
> 
> ----------------------------------------------------------------------
> This email is from Coherent Corp. or a Coherent group company. The contents of this email, including any attachments, are intended solely for the intended recipient and may contain Coherent proprietary and/or confidential information and material. Any review, use, disclosure, re-transmission, dissemination, distribution, retention, or copying of this email and any of its contents by any person other than the intended recipient is strictly prohibited. If you received this email in error, please immediately notify the sender and destroy any and all copies of this email and any attachments. To contact us directly, please email postmaster@coherent.com.   
> 
> Privacy: For information about how Coherent processes personal information, please review our privacy policy at https://ii-vi.com/privacy/.


  reply	other threads:[~2023-07-28 17:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 11:55 panda.trooper
2023-07-27 23:13 ` Brian Inglis
2023-07-28  8:06   ` panda.trooper
2023-07-28 13:23     ` Anders Montonen
2023-07-28 14:15       ` Joel Sherrill
2023-07-28 15:49         ` [EXTERNAL]: " Mike Burgess
2023-07-28 16:11           ` Stefan Tauner
2023-07-28 16:26             ` Mike Burgess
2023-07-28 17:06               ` Richard Damon [this message]
2023-07-28 18:05                 ` Grant Edwards
2023-07-28 18:27           ` panda.trooper
2023-07-28 20:23             ` Jon Beniston
2023-07-28 21:42               ` panda.trooper
2023-07-28 21:53                 ` Jon Beniston
2023-07-29 12:47                   ` Trampas Stern
2023-07-29 13:19                     ` Stefan Tauner
2023-07-29 21:21                     ` Grant Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5F615A8B-DB01-4824-9486-4AD146D6B991@damon-family.org \
    --to=richard@damon-family.org \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).