tags:

views:

79

answers:

2
  const unsigned int omode = cimg::exception_mode();
  cimg::exception_mode() = 0;

Never see this kinda syntax before.

+6  A: 

exception mode might be returning a reference, and it is being set to 0. For example:

unsigned int& exception_mode() { return mode; };

So, the second line would be equivalent to:

void set_exception_mode( uint v ) { mode = v; };

BTW, it is really ugly! I would avoid this kinda syntax as much as I could.

Gianni
+3  A: 

The function is probably returning a reference to an int.

unsigned int exceptionMode; // Declared somewhere
// ...
unsigned int& cimg::exception_mode() { return exceptionMode; }
// ...
cimg::exception_mode() = 0;  // Equivalent to exceptionMode = 0;

This allows whatever is returned to act as an l-value. In this case, it's setting the referred int to zero.

In silico