ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "headius (Charles Nutter)" <headius@headius.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:55642] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
Date: Tue, 25 Jun 2013 12:50:55 +0900	[thread overview]
Message-ID: <redmine.journal-40126.20130625125055@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-8568.20130625061413@ruby-lang.org


Issue #8568 has been updated by headius (Charles Nutter).


Size of a pointer is probably what I'm looking for, since that's usually what people will be using it for. However, implementations that can't give out real pointers can't support pack("p"), so that's not a portable option either.

So... RbConfig::CONFIG['pointer_size'] and some constant?
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40126

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


-- 
http://bugs.ruby-lang.org/

  parent reply	other threads:[~2013-06-25  4:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
2013-06-25  2:01 ` [ruby-core:55641] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
2013-06-25  3:50 ` headius (Charles Nutter) [this message]
2013-06-25  5:05 ` [ruby-core:55643] " nobu (Nobuyoshi Nakada)
2013-06-25 10:48 ` [ruby-core:55647] " naruse (Yui NARUSE)
2013-06-25 11:16 ` [ruby-core:55648] Re: [CommonRuby - Feature #8568][Open] " Tanaka Akira
2013-07-03  7:56 ` [ruby-core:55773] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
2013-07-03  9:46   ` [ruby-core:55775] " Tanaka Akira
2013-07-03  8:03 ` [ruby-core:55774] " nobu (Nobuyoshi Nakada)
2013-09-27 10:45 ` [ruby-core:57425] " headius (Charles Nutter)
2013-10-01  0:40 ` [ruby-core:57509] " headius (Charles Nutter)
2013-10-01  0:59 ` [ruby-core:57513] [CommonRuby - Feature #8568][Closed] " nobu (Nobuyoshi Nakada)
2013-10-01 18:16 ` [ruby-core:57557] [CommonRuby - Feature #8568] " headius (Charles Nutter)
2013-10-02  0:52 ` [ruby-core:57571] " nobu (Nobuyoshi Nakada)
2013-10-02  5:32 ` [ruby-core:57588] " headius (Charles Nutter)
2013-10-02 17:05 ` [ruby-core:57607] " nobu (Nobuyoshi Nakada)
2013-10-02 18:38 ` [ruby-core:57615] " headius (Charles Nutter)
2013-10-02 18:54 ` [ruby-core:57616] " nobu (Nobuyoshi Nakada)

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-list from there: mbox

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

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

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

  git send-email \
    --in-reply-to=redmine.journal-40126.20130625125055@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).