On Wed, May 25, 2011 at 03:29:46PM +0200, Kornel wrote:
> Am Mittwoch, 25. Mai 2011 schrieb Enrico Forestieri:
> > On Wed, May 25, 2011 at 03:08:16PM +0200, Kornel wrote:
> > > Am Mittwoch, 25. Mai 2011 schrieb Enrico Forestieri:
> > > > int main()
> > > > {
> > > > 
> > > >     printf("result: %d\n", afunc());
> > > >     return 0;
> > > > 
> > > > }
> > > 
> > > You explicitly tell here printf() to get singned int.
> > 
> > Ok, but it does not change things. Try the attached better example.
> 
> This does not help to see, if time_t is signed. On my system (int == 64-bit) 
> the value is allways > 0.
> BTW, here it is
>       typedef long int __time_t;
>       typedef __time_t time_t;
> 
> And the output of your program defines:
>       time_t is unsigned

Sigh... Please, reread my previous post where I said "double the number
of F's if your time_t and int types are 64 bit".

I could have used "return (unsigned int)-1;" which automatically gets
converted to either 0xFFFFFFFF or 0xFFFFFFFFFFFFFFFF according to the
size of an int, but I thought that not everybody would have understood
it, and so preferred to the long way with a warning (which next time
I should maybe write in capitals, so that it does not go unnoticed).

-- 
Enrico

Reply via email to