LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-21-2006, 10:00 PM   #1
superluser
LQ Newbie
 
Registered: Aug 2006
Location: Rochester, NY USA
Distribution: PLD
Posts: 10

Rep: Reputation: 0
Unhappy NULL is not a pointer?


gcc is making me cry.

First, the warning:

$ gcc -Wall buttontest.c
buttontest.c: In function `setup_widgets':
buttontest.c:84: warning: passing arg 1 of `GANDI_ch_2text_cr' makes pointer from integer without a cast

Now, the code:

84: btp = GANDIW_push_button_2text (NULL, buttontext[i]);

What's going on, here? I even tried changing NULL to (void *) NULL and (void *) 0. Same error. Am I an idiot?

Can anybody solve this in such a way that it passes -Wall -pedantic without a peep?

edit: Oops. The error from line 85 was something unrelated.

Last edited by superluser; 09-21-2006 at 10:04 PM.
 
Old 09-21-2006, 10:28 PM   #2
pankaj99
Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 47

Rep: Reputation: 15
post your full source code
 
Old 09-21-2006, 10:30 PM   #3
zhangmaike
Member
 
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
Quote:
$ gcc -Wall buttontest.c
buttontest.c: In function `setup_widgets':
buttontest.c:84: warning: passing arg 1 of `GANDI_ch_2text_cr' makes pointer from integer without a cast

Now, the code:

84: btp = GANDIW_push_button_2text (NULL, buttontext[i]);
The error speaks of the function GANDI_ch_2text_cr. You posted a line with the function GANDIW_push_button_2text. These are two different functions. Check your code and make sure you're looking at the right line and the right file.
 
Old 09-21-2006, 10:32 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Try creating a prototype for "GANDI_ch_2text_cr ()", and put it in the appropriate place (at the top of your source file, if it's a one-off; or, even better, in a header).

That should fix the problem.

Your .. PSM

Last edited by paulsm4; 09-21-2006 at 10:33 PM.
 
Old 09-22-2006, 04:26 AM   #5
superluser
LQ Newbie
 
Registered: Aug 2006
Location: Rochester, NY USA
Distribution: PLD
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zhangmaike
The error speaks of the function GANDI_ch_2text_cr. You posted a line with the function GANDIW_push_button_2text. These are two different functions. Check your code and make sure you're looking at the right line and the right file.
Sigh. It looks like (a) I'm an idiot, and (b) GANDIW_push_button_2text is a macro. Aren't macros supposed to be all caps? So you don't confuse them with functions? And argument 1 of GANDI_ch_2text_cr is argument 2 of GANDIW_push_button_2text, so NULL isn't the issue.

I think the developers of GANDI need to learn some conventions. But I need to check the prototype before posting.
 
Old 09-22-2006, 10:07 AM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
OTOH, Well-designed macros should function without you realizing they are macros.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel NULL pointer problem branden_burger Linux - General 0 04-06-2005 09:57 AM
NULL pointer dereference error Mercman2000 Linux - General 1 03-21-2005 09:36 PM
checking pointer is non-null causes segmentation fault in c++ markhod Programming 10 01-11-2005 11:28 AM
freeConfModules called with NULL pointer... opioid Linux - Software 1 10-31-2004 09:04 PM
Null Pointer vijeesh_ep Programming 3 08-13-2004 02:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration