linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shanks <mshanks79@yahoo.co.in>
To: linux-c-programming@vger.kernel.org
Subject: strange gcc warning
Date: Mon, 13 Jan 2003 09:57:55 -0800 (PST)	[thread overview]
Message-ID: <20030113175755.71066.qmail@web8001.mail.in.yahoo.com> (raw)

Hi,

Sample program: b.c
#include <stdio.h>
#include <errno.h>

void
my_print(int errno)
{
    printf("ERRNO: %d\n", errno);
}

int
main()
{
    int a = 10;
    errno = 0;
    my_print(a);
}

On compiling this code i get the warning:
b.c: In function `main':
b.c:15: warning: passing arg 1 of `my_print' makes pointer from integer without
a cast

On running the code i get a seg. fault. So i did some gdb'ing and got
(gdb) run 
Starting program: ./b
Breakpoint 1, my_print (__errno_location=0x19) <<<<<<<<
    at b.c, line...
(gdb)

From above i see that instead of getting a plain int its go the address.
But i would like it if someone explained it to me better.

Thanks in advance.
-S

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

             reply	other threads:[~2003-01-13 17:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-13 17:57 Shanks [this message]
2003-01-13 18:26 ` strange gcc warning Steven Smith
2003-01-14  6:00   ` Shanks
2003-01-13 19:25 ` Elias Athanasopoulos
2003-01-13 18:07   ` Shanks
2003-01-13 21:35     ` Marius Nita
  -- strict thread matches above, loose matches on Subject: below --
2003-01-14  7:01 Govind Raghuram

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=20030113175755.71066.qmail@web8001.mail.in.yahoo.com \
    --to=mshanks79@yahoo.co.in \
    --cc=linux-c-programming@vger.kernel.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 NNTP newsgroup(s).