Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) unsigned

 

unsigned is a keyword that modifies a data type to hold only positive values.

 

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

 

int main()
{
  const unsigned int x = 123; //x can only contain positive integers
}

 

 

 

 

 

References

 

  1. John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 9.2.2: 'Avoid using unsigned in the interface; use int instead'

 

 

 

 

 

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

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict