Mengjiang Liu wrote:
> Tim Hunter wrote:
>> Mengjiang Liu wrote:
>>> i am reading the ruby source, but the follow inits.c confused me.
>>> please give some advices, thanks!
>>> 
>>> what's meaning of the "Init_Array _((void));"?
>>> is it a funtion declare or a macro?
>> 
>> It's a function declaration. Init_Array is an external function that is 
>> defined in array.c.
> since It's a function declaration, and in array.c the init_array define 
> as
> "void init_array()", why not write as "static void init_array();", but
> "void Init_Array _((void))"? what's the meaning of "_((void))"?

_ is a macro that is defined in defines.h. It's purpose is to support 
very old compilers that don't support prototypes. If the compiler 
support prototypes, then

void Init_Array _((void));

expands to

void Init_Array(void);

If the compiler does not support prototypes, it expands to

void Init_Array();



#undef _
#ifdef HAVE_PROTOTYPES
# define _(args) args
#else
# define _(args) ()
#endif
-- 
Posted via http://www.ruby-forum.com/.