Subject: Re:[2] Win32 build problem in ut_rand.cpp
jeremyd@computer.org
Date: Sat Aug 25 2001 - 16:49:58 CDT
Patrick Lam <plam@plam.lcs.mit.edu> wrote on 8/25/2001 4:07:33 PM:
>
>On Sat, 25 Aug 2001, Nikolaj Brandt Jensen wrote:
>
>> ut_rand.cpp
>> ut_rand.cpp(170) : error C2065: 'fptr' : undeclared identifier
>> ut_rand.cpp(170) : error C2440: 'initializing' : cannot convert from
>> 'int' to 'i
>> nt *'
>> Conversion from integral type to pointer type requires
>> reinterpret_cast,
>> C-style cast or function-style cast
>
>Hmm. This is probably my fault, having committed a ut_rand.cpp to work
>around Windows' broken rand() function. Funny, it works fine on Linux.
>I'll look into the error messages and see if something's obviously wrong.
>
>pat
Apparently (at least VC5) does not support initializing a structure,
using its field names to define which field is to be set, at least
in this case. To get it to compile, remove the structure field names
and just just leave the values - making sure their order matches
the order the fields are defined.
that is change the lines:
static struct random_data unsafe_state =
{
fptr : &randtbl[SEP_3 + 1],
rptr : &randtbl[1],
state : &randtbl[1],
rand_type : TYPE_3,
rand_deg : DEG_3,
rand_sep : SEP_3,
end_ptr : &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
};
to:
static struct random_data unsafe_state =
{
&randtbl[SEP_3 + 1],
&randtbl[1],
&randtbl[1],
TYPE_3,
DEG_3,
SEP_3,
&randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
};
and it should compile fine - I make no guarentees about running fine :-)
Jeremy Davis
This archive was generated by hypermail 2b25 : Sat Aug 25 2001 - 17:03:47 CDT