XS Constants peculiarity

Dirk Koopman djk at tobit.co.uk
Thu Oct 28 18:09:55 BST 2010


On 28/10/10 17:26, Chris Jack wrote:
>
> Dirk Koopman djk at tobit.co.uk wrote:
>> This is not my stuff, this is generated from the original header file(s).
>>
>> Prototypes? Functions??
>
> What kind of a solution are you looking for here and what is your real problem?

There is a fair but not insurmountable amount of code. RK+LOCK is common 
(meaning Read Key with Lock on some C-Isam files). More people used to 
the C version of the system are likely to start using it and RK+LOCK is 
a even more common idiom there.

Manually defining all the constants using "use constant" is IMHO a cop 
out without understanding why.

>
> Have you tried the suggestion about surrounding your constants in round brackets? Or is this so widespread in your code that it would take too long.
>

Yes, and it fixes the problem.

There are several hundred constants. Some of which are bit maps.

However it does not explain why a constant, that is generated from a 
header file by h2xs, is taken to be a function with arguments. 
Especially as all the XS code (and generated C) implies it is an integer.

I can see how to make it work (and will do that if necessary) but I 
would like to understand why it is happening in the first place.

Dirk




More information about the london.pm mailing list