Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) long

 

long is a data type like int. Use GetMaxInt and GetMaxLong to compare their maximum values.

 

Avoid using long in a class interface; use int instead [1].

 

int main()
{
  long i = 3;
}

 

 

 

 

 

long code snippets

 

  1. GetMaxLong

 

 

 

 

 

References

 

  1. John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 9.2.3: 'Avoid using long in the interface; assert(sizeof(int)>=4) and use either int or a user-defined large-integer type instead'

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict