octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a Snapshot


From: John W. Eaton
Subject: Re: Creating a Snapshot
Date: Mon, 22 May 2006 17:18:37 -0400

On 22-May-2006, Bill Denney wrote:

| I did a cvs up and then make again and this is what I got:
| 
| oct-rand.cc: In static member function `static ColumnVector
|     octave_rand::state()':
| oct-rand.cc:181: error: invalid conversion from `unsigned int*' to 
| `uint32_t*'
| oct-rand.cc: In static member function `static void 
| octave_rand::state(const
|     ColumnVector&)':
| oct-rand.cc:200: error: invalid conversion from `unsigned int*' to 
| `uint32_t*'
| oct-rand.cc:202: error: invalid conversion from `unsigned int*' to 
| `uint32_t*'
| make[2]: *** [oct-rand.o] Error 1
| make[2]: Leaving directory `/tmp/octave/liboctave'
| make[1]: *** [liboctave] Error 2
| make[1]: Leaving directory `/tmp/octave'
| make: *** [all] Error 2

In oct-rand.cc:

  void
  octave_rand::state (const ColumnVector &s)
  {
    use_old_generators = false;
    maybe_initialize ();

    octave_idx_type len = s.length();
    octave_idx_type n = len < MT_N + 1 ? len : MT_N + 1;
    OCTAVE_LOCAL_BUFFER (unsigned FOUR_BYTE_INT, tmp, MT_N + 1);
    for (octave_idx_type i = 0; i < n; i++)
      tmp[i] = static_cast<unsigned FOUR_BYTE_INT> (s.elem(i));

    if (len == MT_N + 1 && tmp[MT_N] <= MT_N && tmp[MT_N] > 0)
      oct_set_state (tmp);                                        <-- LINE 200
    else
      oct_init_by_array (tmp, len);
  }

and in randmtzig.h:

  #ifdef HAVE_INTTYPES_H
  #include <inttypes.h>
  #else
  #if SIZEOF_INT == 4
  typedef unsigned int uint32_t;
  #elif SIZEOF_LONG == 4
  typedef unsigned long uint32_t;
  #else
  #error "No 4 byte integer type found!"
  #endif

  [...]

  extern void oct_set_state (uint32_t save[]);

so I think the problem is that although FOUR_BYTE_INT is defined to be
"int", which is presumably a 32-bit type, the compiler is not
recognizing it to be the same as uint32_t.

Hmm.  It seems like the best fix for this problem is to arrange to
always use the {u,}intN_t type names defined in stdint.h or
inttypes.h.  It would also be nice to avoid the tricks that we have
been using up until now.  Are there any systems that are capable of
building Octave that do not have either stdint.h or inttypes.h?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]