Generic macros
[QuantLib macros]


Detailed Description

Miscellaneous macros for compiler idiosyncrasies not fitting other categories.


Defines

#define QL_DUMMY_RETURN(x)
 Is a dummy return statement required?
#define QL_IO_INIT
 I/O initialization.


Define Documentation

#define QL_DUMMY_RETURN  ) 
 

Is a dummy return statement required?

Some compilers will issue a warning if it is missing even though it could never be reached during execution, e.g., after a block like

    if (condition)
        return validResult;
    else
        QL_FAIL("whatever the reason");
On the other hand, other compilers will issue a warning if it is present because it cannot be reached. For the code to be portable this macro should be used after the block.

#define QL_IO_INIT
 

I/O initialization.

Sometimes, programs compiled with the free Borland compiler will crash miserably upon attempting to write on std::cout. Strangely enough, issuing the instruction

    std::cout << std::string();
at the beginning of the program will prevent other accesses to std::cout from crashing the program. This macro, to be called at the beginning of main(), encapsulates the above enchantment for Borland and is defined as empty for the other compilers.
Examples:
BermudanSwaption.cpp, ConvertibleBonds.cpp, DiscreteHedging.cpp, EquityOption.cpp, and swapvaluation.cpp.