dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: All
Jun 2, 2000

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


What's a Constant Expression?

In several occasions, C++ requires the use of integral constant expressions, for instance: array bounds, case expressions, bit-field lengths, and enumerator initializers must all be integral constant expressions. An integral constant expression is one of the following:

A numeric literal:

 
  x<100; // 100 is a constant expression
Enumerators:

 
  enum state { up, down};//up & down are constant expressions

Const variables or static data members of integral or enumeration types initialized with constant expressions:

 
  const int x = 0; // x is a constant expression

Non-type template parameters of integral or enumeration types:

 
  S < 100 > s; // a template argument
Sizeof expressions:

 
  sizeof (int);
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date