> On Tue, Mar 10, 2009 at 01:15:14PM +0100, Samuel Thibault wrote:
> That will only work with the gcc compiler, which allows to read a
> union field what you wrote in another. Shouldn't
> (int)(intptr_t)nl_langinfo() be just fine?
Signed-off-by: Karel Zak <kzak@redhat.com>
POSIX: 19971201 + 7 -1 = 0
*/
{
- int wfd;
- union { unsigned int word; char *string; } val;
- val.string = nl_langinfo(_NL_TIME_WEEK_1STDAY);
-
- wfd = val.word;
+ int wfd = (int)(intptr_t) nl_langinfo(_NL_TIME_WEEK_1STDAY);
wfd = day_in_week(wfd % 100, (wfd / 100) % 100, wfd / (100 * 100));
weekstart = (wfd + *nl_langinfo(_NL_TIME_FIRST_WEEKDAY) - 1) % 7;
}