paulftw/hiberlite

constant expression in toSQLiteValue(const char* val)

d-led opened this issue · 3 comments

First, I like your library! :)

The second line in:

int n=strlen(val);
char s[4+2*n];

is invalid though, as n is not a constant expression. You could do:

char* s=new char[4+2*n];
...
delete[] s;

that will work in all compilers. I've noticed it when compiling with Visual Studio.

First, thanks!

Back in the day I made a conscious choice of ignoring MSFT crap. But judging from the feedback I got it seems like everyone else in the world is using hiberlite in Visual Studio.

So I should probably listen to my users - there are not that many of them :)

Will try to fix this once I find some time. In the meantime - are you able to test if suggested approach works in GCC? Extra cleanup feels annoying but not too bad.

You're welcome :).

It should work in gcc, but I'll test. Compilers never "win" for long. Today one should consider clang too. The error messages are especially neat.

I guess this is now fixed?