public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "egallager at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/110047] RFE: Add a warning for use of bare "unsigned" (possibly under -Wimplicit-int?)
Date: Thu, 01 Jun 2023 01:11:28 +0000	[thread overview]
Message-ID: <bug-110047-4-SZ8UoejRZr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110047-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110047

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
Oh, one other thing I'd note here is that gcc/README.portability contains a
part about this, too; I'm copying and pasting it here:

Implicit int
------------

In C, the 'int' keyword can often be omitted from type declarations.
For instance, you can write

  unsigned variable;

as shorthand for

  unsigned int variable;

There are several places where this can cause trouble.  First, suppose
'variable' is a long; then you might think

  (unsigned) variable

would convert it to unsigned long.  It does not.  It converts to
unsigned int.  This mostly causes problems on 64-bit platforms, where
long and int are not the same size.

Ref:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/README.Portability;h=af6904728833193ba57e74ec5bdd4070992efe42;hb=HEAD#l93

      parent reply	other threads:[~2023-06-01  1:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  5:54 [Bug c/110047] New: " egallager at gcc dot gnu.org
2023-05-31  6:54 ` [Bug c/110047] " rguenth at gcc dot gnu.org
2023-06-01  1:11 ` egallager at gcc dot gnu.org [this message]

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=bug-110047-4-SZ8UoejRZr@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).