[prev in list] [next in list] [prev in thread] [next in thread] 

List:       util-linux-ng
Subject:    Re: [PATCH] script: don't assume time_t is compatible with long
From:       Karel Zak <kzak () redhat ! com>
Date:       2015-10-16 10:10:21
Message-ID: 20151016101021.GC2990 () ws ! net ! home
[Download RAW message or body]

On Thu, Oct 15, 2015 at 06:12:59PM -0700, Isaac Dunham wrote:
> I'm guessing that the attached patch would be the most corrrect approach;
> any comments?

 Applied,

> +	if (!str || sscanf(str, "%lld", &sec) != 1)

 Try compile with -Wformat, compiler does not like
 %ll for int64_t types :-)
 
 We usually use %jd and %ju for 64-bit numbers, but real pedantic
 solution is to use SCN macros ("%"SCNi64 in this case) from
 inttypes.h.

 Hmm.. is there any system where intmax_t is already 128-bits? I know
 that gcc already supports __int128_t on some archs, but it's not
 treated as extended integer types. So, I guess we're relative safe
 when we assume that intmax_t is 64-bits :-)

 http://stackoverflow.com/questions/29927562/what-abi-if-any-restricts-the-size-of-uintmax-t

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic