9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Paul Lalonde <plalonde@telus.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] tarfs & 2GB limit
Date: Fri, 13 Jan 2006 16:59:10 -0800	[thread overview]
Message-ID: <CC31E981-FFE7-4F3F-9E0F-175AAE0F516C@telus.net> (raw)
In-Reply-To: <9ab217670601131633x7fa1f177u@mail.gmail.com>

And though it doesn't feel very plan9ish, I'm now going to sing the  
virtues of <inttypes.h>.
having standard sized integer types (int32_t, uint32_t, et al), along  
with intptr_t (an int that can hold any pointer) just makes too much  
sense, and adds information for the reader: you can be pretty sure  
you're mucking with addressing in an intptr_t; and that you need 16  
bits with a uint16_t.

If only converting old code with sizeof(int) == sizeof(int32_t) and  
sizeof(void *) == sizeof(int) assumptions weren't so time consuming :-(

Paul

On 13-Jan-06, at 4:33 PM, Devon H. O'Dell wrote:

> 2006/1/13, C H Forsyth <forsyth@vitanuova.com>:
>> 51c52
>> <               f.addr = (void*)(blkno+1);
>> ---
>>>               f.addr = (void*)((ulong)blkno+1);
>>
>> it will be cleaner to have fileinf declare
>>         union {
>>                 void*   addr;
>>                 ulong   blockno;
>>         };
>> (or whatever is required) and use the right member of the union.
>> just say `no' to converting between void* and integers, when it's  
>> not essential.
>
> Yes, this happens wayyyy too often. Since sizeof(int) and sizeof(void
> *) are not the same on AMD64, there's even more reason to try to avoid
> it.
>
> --Devon



  reply	other threads:[~2006-01-14  0:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-13 14:11 cej
2006-01-13 16:41 ` erik quanstrom
2006-01-13 22:33   ` geoff
2006-01-14  0:30     ` erik quanstrom
2006-01-13 22:36   ` C H Forsyth
2006-01-13 22:43     ` geoff
2006-01-14  0:03       ` erik quanstrom
2006-01-14  0:33     ` Devon H. O'Dell
2006-01-14  0:59       ` Paul Lalonde [this message]
2006-01-14  1:07         ` erik quanstrom
2006-01-14 12:15   ` erik quanstrom
2006-01-14 18:22     ` Russ Cox
2006-01-14 21:27       ` erik quanstrom
2006-01-16  2:57       ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CC31E981-FFE7-4F3F-9E0F-175AAE0F516C@telus.net \
    --to=plalonde@telus.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).