TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Michael Stapleton
date: 1996-07-06 11:25:00
subject: Re: indirection

-=> On 02 Jul 96  21:34 you wrote to me <=-

Hi Paul,

PE> The mktime() example shows a comparison to -1 instead of
PE> (time_t)-1, which could cause problems on certain
PE> implementations (theoretical).

MS> I expect that it could, but I think you may need to explain the
MS> scenario to me.  I suppose that if time_t was an extra wide
MS> integral type then there could be problems analogous to char c =
MS> getchar().

PE> If time_t is an unsigned short, on a system where sizeof short <
PE> sizeof int, then the time_t return of 0xffff will be converted
PE> to 0x0000ffff (e.g.) and not compare equal to 0xffffffff which
PE> is what "-1" is.

Of course!  Promotion from unsigned to signed can be dangerous.  I
notice in another message you're discussing the changes in the
promotion rules.  When in doubt, I refer to K&R2, because I find it
hard to keep the details in my head.  I think this is partly because
I started writing C in 1980 & I learned the old rules first.

Michael Stapleton of Graphic Bits.

 * AmyBW v2.10 *
... This tagline is encrypted
--- AmyBW v2.10
* Origin: The Three Amigas - better than two (3:713/615)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/508 515 713/111 317 601 611 615 618 700 826 888 914 714/906
SEEN-BY: 800/1
@PATH: 713/615 888 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.