delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/29/22:32:24

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Program too large?
Date: Wed, 29 Sep 1999 16:27:21 -0700
Organization: Harvey Mudd College
Message-ID: <37F2A059.9A4AA811@hmc.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990928092947 DOT 17309E-100000 AT is> <7sqj96$kee$1 AT news8 DOT svr DOT pol DOT co DOT uk> <7sqp0b$mtb$1 AT solomon DOT cs DOT rose-hulman DOT edu> <7srlju$65r$1 AT news6 DOT svr DOT pol DOT co DOT uk> <37F18783 DOT BA51E8CE AT earthlink DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 938647673 28573 134.173.45.219 (29 Sep 1999 23:27:53 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 29 Sep 1999 23:27:53 GMT
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586)
X-Accept-Language: en
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Martin Ambuhl wrote:
> 
> Tom Morton wrote:
> 
> > BTW any way of avoiding warnings associated with
> >
> > sprintf(buffer, "%d", long integer);
> >
> > It reports that format should be integer and not long but works fine
> > with long.
> 
> [Yes we know that is not your real code.  Wouldn't have been as easy to
> use
>    long x;
>    sprintf(biffer,"%d", x);
> as your example?  It would avoid an additional syntax error which is
> unrelated to your question.]
> 
> "Works fine" is the road to damnation.  Your code is wrong and needs
> fixing.  You avoid this warning by writing correct code.  The specifier
> for a (signed) long is "%ld".

Or cast the long to int when you pass it.
-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019