Did 1.9 deprecate NUM2INT?

I just upgraded to 1.9 and now my extension won’t compile, complaining
that:

error: 'NUM2INT' was not declared in this scope

Did 1.9 deprecate NUM2INT? What should I use instead? Or has
something else gone wrong?

Regards,

Jeremy H.

On 2010-04-25, Jeremy Henty [email protected].invalid (ie. me)
wrote:

I just upgraded to 1.9 and now my extension won’t compile, complaining
that:

error: 'NUM2INT' was not declared in this scope

OK, I compiled a test example and NUM2INT has not disappeared. So
why would a source file that used NUM2INT and compiled perfectly well
under 1.8, suddenly fail to find NUM2INT under 1.9?

Regards,

Jeremy H.

Jeremy H. wrote:

under 1.8, suddenly fail to find NUM2INT under 1.9?
Maybe what changed is which file includes which other files, and ruby.h
is no longer included? Try including it explicitly…

On 2010-04-25, Jeremy Henty [email protected] (ie. me)
wrote:

OK, I compiled a test example and NUM2INT has not disappeared. So
why would a source file that used NUM2INT and compiled perfectly
well under 1.8, suddenly fail to find NUM2INT under 1.9?

I think this is solved. I appear to have a *.h file that tries to
maintain compatibility with the PreCambrian era by including
workarounds in case NUM2INT is not #define-ed. I suspect that this is
breaking because 1.9 may declare NUM2INT as a static inline instead of
#define-ing it. Anyway, just deleting the compatibility stuff fixes
the problem.

Of course, other stuff is still broken, but, hey, that’s what I get
for relying on fossilised code. :frowning:

Regards,

Jeremy H.

I wonder that there even was such a function loosing precision. If you
still want this cast just do:

(int)NUM2LONG(value)

Wbr

Christoph

---- On Mon, 26 Apr 2010 00:20:10 +0200 Jeremy H.
[email protected] wrote ----

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs