The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Latest win32-api enhancement - 'S' prototypes

0 replies.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a flat view of this topic  Flat View
Previous Topic   Next Topic
Threaded View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Latest win32-api enhancement - 'S' prototypes Posted: Jul 19, 2008 11:15 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: Latest win32-api enhancement - 'S' prototypes
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

The latest installment of the win32-api library will support 'S' (string) prototypes, which will be a distinct entity from 'P' (pointer) prototypes. Users can use 'S' for const char* and 'P' for pass by reference char* buffers. Why the distinction? A few reasons.

First, with pointers we always have to assume mutability. That means making an internal rb_str_modify() call on every pointer, even when it wasn't necessary. That, in turn, lead to some subtle issues, like the fact that you couldn't pass frozen strings to API calls.

Second, it's faster. About 33% faster in my benchmarks, because we don't have to worry that the string will be modified. I don't want to exaggerate the benchmarks, though. The reality is that this will mostly only benefit the MSVCRT functions. Still, it's nice.

Third, I think it will be easier to deal with for other implementations like JRuby and IronRuby, if I ever get around to porting this library. I have a partially complete JRuby version, but references are a pain.

Read: Latest win32-api enhancement - 'S' prototypes


Topic: Capistrano with pairing stations Previous Topic   Next Topic Topic: Announcing a Short, Online Course on JRuby

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use