public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: suckfish@ihug.co.nz
To: gcc-gnats@gcc.gnu.org
Subject: c++/5310: Wierd warnings about using (int)NULL
Date: Mon, 07 Jan 2002 22:46:00 -0000	[thread overview]
Message-ID: <20020108064204.22164.qmail@sources.redhat.com> (raw)


>Number:         5310
>Category:       c++
>Synopsis:       Wierd warnings about using (int)NULL
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 07 22:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     suckfish@ihug.co.nz
>Release:        3.0.3
>Organization:
>Environment:
Debian GNU Linux, i686.
Debian gcc package gcc-3.0-3.0.3-1
>Description:
The attached file, compiled with g++ -Wall generates:

temp.cc: In function `void bar()':
temp.cc:8: warning: passing NULL used for non-pointer argument passing 1 of 
   `void foo(int)'
temp.cc:8: warning: argument to non-pointer type `int' from NULL

I think the warning message is bogus.  The argument expression has been cast to an int, so the compiler should not warn about using it as an int argument.

If it is decided that the warning message from line 8 is in fact correct, then line 9 should also give a warning (using NULL as a long is just as silly as using NULL as an int).
>How-To-Repeat:
Compile attached file with g++ -Wall
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="temp.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="temp.cc"

Ly8gQ29tcGlsZSBhcyBDKysgd2l0aCAtV2FsbAojaW5jbHVkZSA8c3RkbGliLmg+Cgp2b2lkIGZv
byAoaW50KTsKdm9pZCBmb28gKGxvbmcpOwoKdm9pZCBiYXIoKQp7CiAgIGZvbyAoKGludClOVUxM
KTsKICAgZm9vICgobG9uZylOVUxMKTsKfQo=


             reply	other threads:[~2002-01-08  6:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-07 22:46 suckfish [this message]
2002-09-15 12:25 nathan

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=20020108064204.22164.qmail@sources.redhat.com \
    --to=suckfish@ihug.co.nz \
    --cc=gcc-gnats@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).