🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2288

Re: 'h' modifier in printf

#2288
From: T.E.Dickey
Date: Thu, 14 Mar 1996 14:20
17 lines
1004 bytes
Michael J Zehr (tada@athena.mit.edu) wrote:
: The "h" modifier says the corresponding argument will be printed as a
: short or unsigned short.
...
: short s;
: printf("%d", s);
: printf("%hd", s);
... 
: Can these two ever be different?  I'm aware of course that the short is
: widened to an int during the function call, but this preserves the
: value.
sure can -- you're overlooking sign extension
 

-- 
Thomas E. Dickey
dickey@clark.net
Technical Details
Message-ID: <4i99vc$91r@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4i801c$455@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: dickey@clark.net (T.E.Dickey)
Newsgroups: comp.lang.c.moderated,comp.std.c
Subject: Re: 'h' modifier in printf
Followup-To: comp.lang.c.moderated,comp.std.c
Date: 14 Mar 1996 08:20:28 -0600
Organization: Clark Internet Services, Inc., Ellicott City, MD USA
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4i99vc$91r@solutions.solon.com>
References: <4i801c$455@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]