473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to get Gcc 2.95 to shut up with -Wall -04 on this code. :)

Have ported Until 2.5.2 which is a highly portable embedded FORTH-like
language system to BeOS. Turned on -Wall cause I'm anal about cleaning
up ports if I'm doing them, and have all but ONE warning that I don't seem
to be able to get cleaned up... Simply...

printf("%-10s %12lx %1d\n", temp->NFA->name, &temp, temp->NFA->immediate);

produces a gcc2.95 warning:

prim.c: In function `display_word':
prim.c:2203: warning: long unsigned int format, pointer arg (arg 3)

where temp is defined

struct DictHeader *temp;

with the of-importance struct defs:

struct NameField {
int len;
int system;
int immediate;
int smudge;
char *name;
struct view_location *view;
};

struct DictHeader {
void (*CFA)(); /* ptr to primitive function */
union pfa_type PFA; /* ptr to list of words to execute */
struct NameField *NFA; /* ptr to name string */
struct DictHeader *LFA; /* points to next word in dict. */
};

I'm rather perplexed, without -Wall the warning doesn't come on at all. So,
would someone please enlighten me on how to get the compiler to shut up :)

Thank you, please email me directly, I do not frequent this group at all.

Best wishes!
Nov 13 '05 #1
3 2034

"Todd Nathan" <bi***********@yahoo.com> wrote in message
news:5d**************************@posting.google.c om...
Have ported Until 2.5.2 which is a highly portable embedded FORTH-like
language system to BeOS. Turned on -Wall cause I'm anal about cleaning
up ports if I'm doing them, and have all but ONE warning that I don't seem
to be able to get cleaned up... Simply...

printf("%-10s %12lx %1d\n", temp->NFA->name, &temp, temp->NFA->immediate);

produces a gcc2.95 warning:

prim.c: In function `display_word':
prim.c:2203: warning: long unsigned int format, pointer arg (arg 3)


How to get rid of warnings:

Method 1
------------
gcc mystuff.c >/dev/null

Method 2
------------
printf("%-10s %12lx %1d\n", temp->NFA->name, (unsigned long)&temp, temp->NFA->immediate);
^^^^^

jacob
Nov 13 '05 #2
Allin Cottrell wrote:
Richard Heathfield wrote:

printf("%-10s %p %1d\n", temp->NFA->name, (void *)&temp,
temp->NFA->immediate);


To be a little more expansive (Richard knows all this, but didn't
choose to say it):

1) The "%p" conversion is the only standard-compliant way of printing
a pointer value. Use of one of the regular integer types implies that
you (think you) know more about the representation of pointer values
than is guaranteed by the C standard.

2) Have chosen "%p", the cast "(void *)" is required (in a notable
exception to the rule that casts in C are unneccessary if not evil)
since arguments to variadic functions such as printf() are not
subject to the usual automatic type-conversion, "%p" conversion
requires a (void *) argument, and "&temp" is not in itself a void
pointer.

Beautifully put. You have done all the typing I didn't want to do. My
thanks.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #3
On Sun, 10 Aug 2003 00:01:41 +0200,
jacob navia <ja*********@jacob.remcomp.fr> wrote
in Msg. <bh**********@news-reader1.wanadoo.fr>
Richard, sorry but should be (unsigned long) since the %d format expects
an integer of some sort.
....which is what it gets.
You should use %p for pointer data.


....which is what he did. You need to read more carefully before you follow
up.

--d.

--
"With me is nothing wrong! And with you?" (from r.a.m.p)
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel | last post by:
Is there any way for System.IO.StreamWriter Write method to write out part of the string to file. such as if the machine is shut down half way through? or does the file not actually exist until the...
6
by: Omey Samaroo | last post by:
Can anyone suggest a practical idea that I can use to "shut-down" users that might still be connected to a database or logged off improperly so I can compact the back-end? Thanks for your...
0
by: Jesper | last post by:
Hi, I would like a program invoked when the user commands the computer to shut down. Just like it can be invoked at startup by placing it in the startupfolder. Thanks, Jesper.
3
by: BrianDH | last post by:
Hi I have a VB.Net windows application that for some reason when running will not allow the user to shut-down/reboot the Operating System without first closing my application. Has anyone had the...
0
by: Robert Fitzpatrick | last post by:
I am getting 'postmaster does not shut down' when trying to stop the database with '.../pg_ctl -D /path/to/datadir stop -m fast. How should I proceed to get the database shut down and restarted?...
8
by: Austen | last post by:
Hello i trying to shut down window using vb. i able to restart and log off, but was unable to shut down. when excute the shut down command , nothing happend. it related to window os security issue?
5
by: Yoofer | last post by:
Now, do you see why corporations are evil? Next up, RIAA declares that its supporters have a patent on sunlight, tries to blot out the sky. ...
5
by: Bubba | last post by:
Hi, We have HttpHandlers that can process requests for up to 50 minutes. Those HttpHandlers are running in an app domain inside the DefaultAppPool. We'd like the HttpHandlers to be able to...
3
by: mturner64 | last post by:
I have heard arguments from both sides of the field. Some prefer to shut down daily and others prefer to leave computers running and only shut them down to re-boot a few times per month. What are...
5
freddieMaize
by: freddieMaize | last post by:
Hi Guys, I run a lot of task in my system. Every day i shut down the system.. Which means, when i come the next day i have got to start all the task again which consumes a lot of time.. I know...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.