News for hackers. Stuff that matters.
Re:Never create Ruby strings longer than 23 characters by archangel_one on Wednesday January 04, 2012 @02:43PM (#3425542)
That seems like a slightly dubious choice to me, since unsigned long isn't guaranteed to be as long as a pointer; for example, under Microsoft's 64-bit compiler it's still only 4 bytes, but pointers are obviously 8. Possibly there is some extra preprocessor cleverness to deal with it, or maybe they don't expect it to work under that compiler?
Re:Never create Ruby strings longer than 23 characters by ben0x539 on Wednesday January 04, 2012 @03:51PM (#3425844)
Yeah, there's preprocessor cleverness. It will choose either of unsigned, unsigned long or unsigned long long. There's a "#if defind HAVE_UINTPTR_T && 0" section, I'm curious why they're effectively disabling that.
Re:Never create Ruby strings longer than 23 characters by jof on Wednesday January 04, 2012 @02:58PM (#3425615)
Isn't this what C99's uintptr_t type tries to address?
Re:Never create Ruby strings longer than 23 characters by archangel_one on Wednesday January 04, 2012 @03:16PM (#3425703)
Yes, exactly. I'm just a little curious since, without knowing anything about the code at all, unsigned long doesn't seem like a great choice. I'm sure the Ruby devs would know this though so I expect there must be some reason for it.
Re:Never create Ruby strings longer than 23 characters by bhousel on Wednesday January 04, 2012 @03:51PM (#3425842)
Here's the code: https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#...

It looks like uintptr_t support is there, just disabled for now.

Re:Never create Ruby strings longer than 23 characters by archangel_one on Wednesday January 04, 2012 @04:01PM (#3425877)
Thanks - the fallback to long long explains it for me.