Article View: comp.lang.c.moderated
Article #2289Re: 'h' modifier in printf
From: Thad Smith
Date: Fri, 15 Mar 1996 03:23
Date: Fri, 15 Mar 1996 03:23
17 lines
1027 bytes
1027 bytes
In article <4i98fl$8ml@solutions.solon.com>,
baynes@ukpsshp1.serigate.philips.nl wrote:
>: int i;
>: printf("%hd", i);
>: printf("%d", (short)i);
>
>I think if the value of i is outside SHRT_MIN to SHRT_MAX then both are
>undefined for different reasons. The first printf (%hd) because the conversion
>does not apply to a short integer. The second printf (%d of (short)) because
>the cast of i to (short) is not defined when i is out of range.
Actually the result of the conversion in the second printf is
implementaion-defined.
Thad
Technical Details
Message-ID:
<4ianrq$het@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4i801c$455@solutions.solon.com> <4i98fl$8ml@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: thads@csn.net (Thad Smith) Newsgroups: comp.lang.c.moderated,comp.std.c Subject: Re: 'h' modifier in printf Date: 14 Mar 1996 21:23:38 -0600 Organization: T3 Systems Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4ianrq$het@solutions.solon.com> References: <4i801c$455@solutions.solon.com> <4i98fl$8ml@solutions.solon.com> Reply-To: ThadSmith@acm.org NNTP-Posting-Host: solutions.solon.com