I can't find the reference at the moment, but a while back when this issue
came up regarding slice len, Robert Griesmer opined that signed integers
are preferred when counting things because unsigned counts don't go
negative, they go insanely positive on wrap around. The rule of thumb I
draw from that is
- signed ints for counting things
- unsigned ints for bitfields and flags
On Monday, 14 August 2017 11:57:30 UTC+10, peterGo wrote:
>
> Timothy,
>
> struct stat {
> /* ... */
> off_t st_size; /* total size, in bytes */
> /* ... */
> };
>
> off_t is a signed integer.
>
> File offsets can be negative.
>
> Peter
>
> On Sunday, August 13, 2017 at 8:27:21 PM UTC-4, Timothy Raymond wrote:
>>
>> I was working with filepath.Walk(), and I noticed something peculiar
>> about the os.FileInfo interface that the filepath.WalkFunc receives.
>> According to the definition here: https://golang.org/pkg/os/#FileInfo,
>> the Size() method returns an int64. Shouldn't this be a uint64? Is there a
>> sane instance on some platform of a negative file size?
>>
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.