Re: What does ((time_t)-1) mean?
- From: Richard <rgrdev@xxxxxxxxx>
- Date: Wed, 24 Oct 2007 21:36:58 +0200
Kenneth Brody <kenbrody@xxxxxxxxxxx> writes:
Kenny McCormack wrote:
In article <1193218158.633181.69180@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
loudking <loudking@xxxxxxxxx> wrote:
Hello, all
I don't quite understand what does ((time_t)-1) mean when I execute
"man 2 time"
This (perfectly legal) program says that the answer to your question is 5:
#include <stdio.h>
int main(void)
{
int time_t = 6;
printf("The result is %d\n",((time_t)-1));
return 0;
}
Is it legal to declare a variable named "time_t"? True, you have
not included <time.h> which is why it "works".
Are you allowed to repurpose a type/variable/macro defined by the
standard, as long as you don't use anything related to the way
the standard defines them?
If, for example, defining your own printf() function invokes UB,
even if you never make reference (direct or otherwise) to the
standard's printf() function, doesn't the same hold true for the
time_t typedef?
If you don't include the definition then why isn't it perfectly ok?
Stupid, but ok.
.
- Follow-Ups:
- Re: What does ((time_t)-1) mean?
- From: santosh
- Re: What does ((time_t)-1) mean?
- References:
- What does ((time_t)-1) mean?
- From: loudking
- Re: What does ((time_t)-1) mean?
- From: Kenny McCormack
- Re: What does ((time_t)-1) mean?
- From: Kenneth Brody
- What does ((time_t)-1) mean?
- Prev by Date: Re: array index type
- Next by Date: Re: array index type
- Previous by thread: Re: What does ((time_t)-1) mean?
- Next by thread: Re: What does ((time_t)-1) mean?
- Index(es):
Relevant Pages
|