eliminate variable length arrays from AtC lib for C++ standard compliance

This commit is contained in:
Axel Kohlmeyer
2018-05-07 17:36:34 -04:00
parent bfdfd36c1c
commit 104dde27ed
9 changed files with 52 additions and 29 deletions

View File

@ -1,3 +1,4 @@
#include <alloca.h>
#include "Function.h"
#include "ATC_Error.h"
#include "LammpsInterface.h"
@ -58,7 +59,7 @@ namespace ATC {
{
string type = args[0];
int narg = nargs -1;
double dargs[narg];
double *dargs = alloca(sizeof(double) * narg);
for (int i = 0; i < narg; ++i) dargs[i] = atof(args[i+1]);
return function(type, narg, dargs);
@ -192,7 +193,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL;
{
string type = args[0];
int narg = nargs -1;
double dargs[narg];
double *dargs = alloca(sizeof(double) * narg);
for (int i = 0; i < narg; ++i) dargs[i] = atof(args[i+1]);
return function(type, narg, dargs);