>>>>> "C" == Charles E Thornton <ruby-core / hawthorne-press.com> writes:

>>>>> "C" == Charles E Thornton <ruby-core / hawthorne-press.com> writes:

C> Could you provide a Code Fragment to cause this feature to
C> come into existence?

 I can :-)


C> Can you describe in a paragraph WHAT is being Done and WHY this FLAG
C> and PACK.c are doing to support it :-|

moulon% gdb ruby
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) b rb_f_p
Breakpoint 1 at 0x8078bff: file io.c, line 3881.
(gdb) r -e 'p ["a", "b"].pack("p*")'
Starting program: /i/home/msys/decoux/ruby/ruby-1.8.3/ruby -e 'p ["a", "b"].pack("p*")'

Breakpoint 1, rb_f_p (argc=1, argv=0xbfffd9a0) at io.c:3881
3881	    for (i=0; i<argc; i++) {
(gdb) p ((struct RString *)argv[0])->basic.flags
$1 = 16391
(gdb)  p 7|(1<<14)
$2 = 16391
(gdb) p *(struct RArray *)(((struct RString *)argv[0])->aux.shared)
$3 = {basic = {flags = 9, klass = 3085202720}, len = 2, aux = {capa = 16, shared = 16}, ptr = 0x8128ad8}
(gdb) p *(struct RString *)((struct RArray *)(((struct RString *)argv[0])->aux.shared))->ptr[0]
$4 = {basic = {flags = 8199, klass = 3085223860}, len = 1, ptr = 0x8128a10 "a", aux = {
    capa = -1209802416, shared = 3085164880}}
(gdb) p *(struct RString *)((struct RArray *)(((struct RString *)argv[0])->aux.shared))->ptr[1]
$5 = {basic = {flags = 8199, klass = 3085223860}, len = 1, ptr = 0x8128a20 "b", aux = {
    capa = -1209802476, shared = 3085164820}}
(gdb) p 7|(1<<13)
$6 = 8199
(gdb) c
Continuing.
"\020\212\022\010 \212\022\010"

Program exited normally.
(gdb) q
moulon% 

 7|(1<<14) == T_STRING|STR_ASSOC
 7|(1<<13) == T_STRING|ELTS_SHARED


 I hope this make a paragraph :-)



Guy Decoux