octave-maintainers
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
MSVC compilation patch: OCTAVE_LOCAL_BUFFER
From
:
michael . goffioul
Subject
:
MSVC compilation patch: OCTAVE_LOCAL_BUFFER
Date
:
Thu, 09 Nov 2006 15:20:21 +0100
Creating a 0-sized std::vector and accessing its first element produces a crash under
MSVC. The attached patch solves it. I didn't use any #ifdef as it looks safer under any
system.
Michael.
Index: configure.in
===================================================================
RCS file: /cvs/octave/configure.in,v
retrieving revision 1.544
diff -c -p -r1.544 configure.in
*** configure.in 6 Nov 2006 17:52:52 -0000 1.544
--- configure.in 9 Nov 2006 14:16:30 -0000
*************** typedef int sig_atomic_t;
*** 1920,1926 ****
#define OCTAVE_LOCAL_BUFFER(T, buf, size) \\
std::vector< T > buf ## _vector (size); \\
! T *buf = &(buf ## _vector[0])
/* #endif */
--- 1920,1926 ----
#define OCTAVE_LOCAL_BUFFER(T, buf, size) \\
std::vector< T > buf ## _vector (size); \\
! T *buf = ( (size) > 0 ? &(buf ## _vector[0]) : NULL )
/* #endif */
reply via email to
[Prev in Thread]
Current Thread
[
Next in Thread
]
MSVC compilation patch: OCTAVE_LOCAL_BUFFER
,
michael . goffioul
<=
MSVC compilation patch: OCTAVE_LOCAL_BUFFER
,
John W. Eaton
,
2006/11/09
Prev by Date:
Clarification about the octave-gpcl licensing conditions
Next by Date:
MSVC patch: memory corruption in load-path.cc
Previous by thread:
Clarification about the octave-gpcl licensing conditions
Next by thread:
MSVC compilation patch: OCTAVE_LOCAL_BUFFER
Index(es):
Date
Thread