Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Error assigining dependent value to variable at file scope

$
0
0

I want to make a few read-only variables, at file-scope. A couple of them are dependent on other such variables. A sample code is as follows:

static const double A = 1.0;
static const double B = A/5;
int main(){}

Compiling this gives me the error:

expression must have a constant value

But GCC does not complain. Is this a bug in ICC, or is it GCC that isn't standard compliant?

Is this relevant: ?
https://software.intel.com/en-us/forums/intel-c-compiler/topic/286645


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>