BSalunke
BSalunke

Reputation: 11737

What is the type of variable?

Im working on Ruby c extension, I have following code from c program,

VALUE var = myFunction(arg1, arg2);
int varType = TYPE(var);
printf("Type of the var is :: %d", varType);

Above printf gives output as follow:

Type of the var is :: 34

As myFunction is inbuild function i dont know the return type of that function. can any one tell me the type of "var" variable return from myFunction? Thanks in advance.

Upvotes: 0

Views: 166

Answers (2)

Jeegar Patel
Jeegar Patel

Reputation: 27230

var RETURNING FROM MyFunction is type of VALUE

and VALUE is typedef defined in ruby.h

definition

typedef unsigned long VALUE;

Upvotes: 0

jpalecek
jpalecek

Reputation: 47770

The TYPE macro returns values enumerated in ruby.h. From there, it follows 34 is T_DATA, which is a wrapped C structure.

Upvotes: 3

Related Questions