classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view


David Bateman-2
While porting the MTEX package ( I came
across another issue that I've been working around, but on reflection
should probably be treated in Octave itself. Matlab defines the macros


for use in mex-files, however these values depend on the type used for
the mwsize and mwindex types, although the *_MIN macros are always zero.
I can't use std::numeric_limits<mwsize>::max() to get this value as
mex.h is generally included in C programs and so I have to think of
another way of getting this values. This is complicated by the variable
substitution used to create mxarray.h from What I was
thinking of doing is adding

#if (%USE_64_BIT_IDX_T%)
#define MWSIZE_MAX 9223372036854775807L
#define MWINDEX_MAX 9223372036854775807L
#define MWSIZE_MAX 2147483647
#define MWINDEX_MAX 2147483647
#define MWSIZE_MIN 0
#define MWINDEX_MIN 0

just below the typedefs for mwsize and mwindex, then also substitute
USE_64_BIT_IDX_T when creating mxarray.h from I could
probably use the values from limits.h directly, though using the numeric
values seems safer to me.

Any objections from making this change in the stable branch?