Buggy sbspace() on 64bit builds?

hiren panchasara hiren at strugglingcoder.info
Wed Mar 11 18:26:15 UTC 2015


On 02/06/15 at 05:03P, Simon J. Gerraty wrote:
> Anuranjan Shukla <anshukla at juniper.net> wrote:
> > this, along with return value being 'int' acceptable as a final
> > determination? 
> 
> It is ok for the function to return long, 
> so long as an int is used internally.
> Casting the int to long - implicit on return does no harm.
> 
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> 
> int
> main(int argc, char *argv[])
> {
>     uint a, b;
>     long r1;
>     int r2;
> 
>     a = 1;
>     b = 2;
> 
>     r1 = a - b;
>     r2 = a - b;
> 
>     printf("r1=%ld\nr2=%d\nr3=%ld\n", r1, r2, (long)r2);
>     exit(0);
> }
> 
> r1=4294967295
> r2=-1
> r3=-1
> 
> so I think just using 'int' internally should work for now,
> perhaps with a comment saying the object size should match
> those being subtracted etc.

Hi Simon/Anu,

Has this been committed yet? I believe I am running into something
similar in our stable10 build. I am not certain though. In any case,
this should be committed/mfc'd.

Cheers,
Hiren
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 618 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20150311/8f02a8aa/attachment.sig>


More information about the freebsd-arch mailing list