Re: [9fans] subtracting pointers on amd64 6c

2016-01-06 Thread erik quanstrom
On Tue Jan 5 23:02:59 PST 2016, cinap_len...@felloff.net wrote: > it appears that %t and %z are already used by a bunch of programs, > including the kernel: > > term% grep -n 'fmtinstall\(''[zt]''' */*.c */*/*.c */*/*/*.c > cmd/trace.c:137: fmtinstall('t', timeconv); > 9/port/edf.c:122:

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Charles Forsyth
On 5 January 2016 at 10:15, Charles Forsyth wrote: > 2) if a pointer subtraction has to yield a long, why dont we cast *after* >> the division? >> > > that would be certainly be better. > since 6c is more commonly used now, and there's more interest or need, it's

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Charles Forsyth
On 5 January 2016 at 07:53, wrote: > rsc has fixed this in the go 6c compiler. so far most code > seems to compile and work fine. the most fallout is with > long x = p - q; T *y = p+x; really there needs to be a new typedef for the difference type.

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Devon H. O'Dell
2016-01-05 2:28 GMT-08:00 Charles Forsyth : > since 6c is more commonly used now, and there's more interest or need, it's > probably best just to introduce > the difference type and change the result type. it's the same thing with > usize. i get that probably nobody

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread cinap_lenrek
it appears that %t and %z are already used by a bunch of programs, including the kernel: term% grep -n 'fmtinstall\(''[zt]''' */*.c */*/*.c */*/*/*.c cmd/trace.c:137:fmtinstall('t', timeconv); 9/port/edf.c:122: fmtinstall('t', timeconv); cmd/db/output.c:159:

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread cinap_lenrek
> there are usable ANSI formats for the difference and sizeof types. so one would write %td instead of %ld for ptrdiff type? that seems easy. i'm not so sure how usize/ssize would work. %zud and %zd? or would the z flag imply unsigned? would the return type of sizeof() also become usize? --

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Devon H. O'Dell
2016-01-05 12:40 GMT-08:00 erik quanstrom : > On Tue Jan 5 11:49:06 PST 2016, charles.fors...@gmail.com wrote: > >> On 5 January 2016 at 19:01, Devon H. O'Dell wrote: >> >> > so given any of the examples in this thread, if you typedef'ed >> >

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread erik quanstrom
> since 6c is more commonly used now, and there's more interest or need, > it's probably best just to introduce the difference type and change > the result type. it's the same thing with usize. i'll see if i can > add some code to check for mismatches automatically. > > there are usable ANSI

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread erik quanstrom
On Tue Jan 5 11:49:06 PST 2016, charles.fors...@gmail.com wrote: > On 5 January 2016 at 19:01, Devon H. O'Dell wrote: > > > so given any of the examples in this thread, if you typedef'ed > > ptrdiff_t to long, then the compiler technically isn't actually doing > >

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Devon H. O'Dell
2016-01-05 14:32 GMT-08:00 : >> there are usable ANSI formats for the difference and sizeof types. > > so one would write %td instead of %ld for ptrdiff type? that seems > easy. yes, and there's support for u/i/o/X/x/etc modifiers > i'm not so sure how usize/ssize

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Devon H. O'Dell
2016-01-05 14:57 GMT-08:00 Devon H. O'Dell : > 2016-01-05 14:32 GMT-08:00 : >>> there are usable ANSI formats for the difference and sizeof types. >> >> so one would write %td instead of %ld for ptrdiff type? that seems >> easy. > > yes, and

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread erik quanstrom
> ...and arguing with it, based on assuming charles is disagreeing with > me about reasonable behavior. he isn't. apparently, you didn't take > the time to read what i had written in the first place. or at least > not past the first sentence. > > this is really annoying to me because it tends to

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread erik quanstrom
On Tue Jan 5 14:34:52 PST 2016, cinap_len...@felloff.net wrote: > > there are usable ANSI formats for the difference and sizeof types. > > so one would write %td instead of %ld for ptrdiff type? that seems > easy. yup. > i'm not so sure how usize/ssize would work. %zud and %zd? or would > the

Re: [9fans] subtracting pointers on amd64 6c

2016-01-05 Thread Dave Eckhardt
> for instance, although the range of subtraction is theoretically > -2^64+1 to 2^64-1, amd64 can only address 48 bits of memory > (currently) despite using 64 bits to represent addresses. as long > as virtual addresses in the system aren't exabytes apart, this > shouldn't result in undefined