Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

What is the efficiency of const

New Here ,
Jul 30, 2014 Jul 30, 2014

Is any optimization done with operations involving constants, particularly converting operations with const to literal values.

I know the C++ compiler will effectively (not literally) convert this code:

const int VALUE_1 = 5;

const int VALUE_2 = 2;

int value3 = VALUE_1 + VALUE_2;

into something like this:

int value3 = 7;

This saves the program from adding 5 and 2 together while the program is running. I know that AS3 with flash is an interpreted language, so I'm not sure if the same can be done with it.

Does any optimization take place with const when declared on the method or class levels?

TOPICS
ActionScript
224
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 31, 2014 Jul 31, 2014
LATEST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines