Adding comment relating to issue and move around fix preprocessor locations

release/4.3a0
Andrew Melim 2014-12-09 11:49:13 -05:00
parent 3bd491bf66
commit 90676199dd
1 changed files with 11 additions and 6 deletions

View File

@ -206,20 +206,25 @@ private:
// with an execution trace, made up entirely of "Record" structs, see
// the FunctionalNode class in expression-inl.h
size_t size = traceSize();
// Windows does not support variable length arrays, so memory must be dynamically
// allocated on Visual Studio. For more information see the issue below
// https://bitbucket.org/gtborg/gtsam/issue/178/vlas-unsupported-in-visual-studio
#ifdef _MSC_VER
ExecutionTraceStorage* traceStorage = new ExecutionTraceStorage[size];
ExecutionTrace<T> trace;
T value(traceExecution(values, trace, traceStorage));
trace.startReverseAD1(jacobians);
delete[] traceStorage;
return value;
#else
ExecutionTraceStorage traceStorage[size];
#endif
ExecutionTrace<T> trace;
T value(traceExecution(values, trace, traceStorage));
trace.startReverseAD1(jacobians);
return value;
#ifdef _MSC_VER
delete[] traceStorage;
#endif
return value;
}
// be very selective on who can access these private methods: