开发者

Android Renderscript 3.2 More Strict Than 3.1?

开发者 https://www.devze.com 2023-03-26 04:11 出处:网络
I updated my Eclipse Android SDK to version 3.2 and I\'m now getting compilation errors for constants.

I updated my Eclipse Android SDK to version 3.2 and I'm now getting compilation errors for constants.

This used to work:

static const X = 2;
static const X_SQUARED 开发者_开发技巧= X * X;

But now I get a compilation error on the 2nd line:

error: initializer element is not a compile-time constant

Was this an intentional change? Or is there perhaps something wrong in my environment?

Thanks!


RenderScript is C99, not C++. C99 requires that all static initializations be constant expressions (integer constants, floating constants, enumeration constants, character constants, and sizeof expressions).

The RenderScript compiler must have become more strict about this. This code never should have compiled (and in fact, does not compile with a regular C99 compiler).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号