From bug-request at octave dot org Sun Apr 16 17:45:46 2006 Subject: Re: CVS Compilation with PGI compiler From: "John W. Eaton" To: Paul Kienzle Cc: "bug at octave dot org mailing list" Date: Sun, 16 Apr 2006 18:45:14 -0400 On 16-Apr-2006, Paul Kienzle wrote: | Did you use: | | OCTAVE_LOCAL_BUFFER(bool, found, nrows) | | or have we concluded that std::vector is now well supported and is | the one true way to allocate arbitrary sized local storage? I started by trying to use the macro, but it failed for me with bool because OCTAVE_LOCAL_BUFFER (bool, found, nrows); expands to std::vector found_vector (nrows); bool *found = (&found_vector[0]); and the second statement fails because std::vector is implemented as some kind of bit vector and taking the address of the first element doesn't produce pointer that can be assigned to bool*. | I believe it is the latter and use of OCTAVE_LOCAL_BUFFER in | octave and octave-forge should be considered cruft. OCTAVE_LOCAL_BUFFER has been unconditionaly using std::vector for some time now and I haven't seen any complaints about it, so I think we can start to eliminate the macro. But now I'm wondering about whether it is actually valid to do the pointer trick we have used above to access the elements of the array. Is that guaranteed to work? It doesn't seem to for std::vector, so maybe we should take another look at the code that uses the OCTAVE_LOCAL_BUFFER macro. jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------