hr3.h redefines the throw keyword


ran.rubin
07-10-2012, 09:49 AM
While debugging some code I did not write, I encountered some strange compile error with some libstdc standard include files.

It appears that something like:

int f(int arg) throw();

can not be compiled (even though it is correct c++ syntax)

After much effort I found out the source of the problem in the nr3.h file were the throw keyword is defined as a preprocessor macro.

This seems to me a not so good practice since it changes the basic definitions of the language and can (and does) effect other pieces of code not written with NR.

In addition defining it with a macro makes debugging much more difficult...

I suggest to rename the throw macro to NRthrow. This will result with the same functionally without the conflict with other libraries.

I hope you'll continue to give us great guidance and advice regarding numerical computations! Your book is a great resource for every student and scientist!

Ran