blob: 35f3548ffc6ae199ed3d3d967e9ff4c2b1b2c745 [file] [log] [blame]
[/ Copyright (C) 2009-2012 Lorenzo Caminiti ]
[/ Distributed under the Boost Software License, Version 1.0 ]
[/ (see accompanying file LICENSE_1_0.txt or a copy at ]
[/ http://www.boost.org/LICENSE_1_0.txt) ]
[/ Home at http://www.boost.org/libs/local_function ]
[section:no_variadic_macros Annex: No Variadic Macros]
This section illustrates an alternative syntax for compilers without variadic macro support.
[heading Sequence Syntax]
Most modern compilers support [@http://en.wikipedia.org/wiki/Variadic_macro variaid macros] (notably, these include GCC, MSVC, and all __CXX11__ compilers).
However, in the rare case that programmers need to use this library on a compiler without variadic macros, this library also allows to specify its macro parameters using a __Boost_Preprocessor__ sequence where tokens are separated by round parenthesis `()`:
(token1) (token2) ... // All compilers.
Instead of the comma-separated list that we have seen so far which requires variadic macros:
token1, token2, ... // Only compilers with varidic macros.
For example, the following syntax is accepted on all compilers with and without variadic macros (see also [@../../test/add_seq.cpp =add_seq.cpp=]):
[add_seq]
However, on compilers with variadic macros the comma-separated syntax we have seen so far is preferred because more readable (see also [@../../test/add.cpp =add.cpp=]):
[add]
Note that the same macros accept both syntaxes on compilers with variadic macros and only the sequence syntax on compilers without variadic macros.
Finally, an empty local function parameter list is always specified using `void` on compilers with and without variadic macros:
[ten_void]
[heading Examples]
For reference, the following is a list of most of the examples presented in this documentation reprogrammed using the sequence syntax instead of the comma-separated syntax (in alphabetic order):
[table
[ [Files] ]
[ [[@../../test/add_classifiers_seq.cpp =add_classifiers_seq.cpp=]] ]
[ [[@../../test/add_default_seq.cpp =add_default_seq.cpp=]] ]
[ [[@../../test/add_except_seq.cpp =add_except_seq.cpp=]] ]
[ [[@../../test/add_inline_seq.cpp =add_inline_seq.cpp=]] ]
[ [[@../../test/add_params_only_seq.cpp =add_params_only_seq.cpp=]] ]
[ [[@../../test/add_template_seq.cpp =add_template_seq.cpp=]] ]
[ [[@../../test/add_this_seq.cpp =add_this_seq.cpp=]] ]
[ [[@../../test/add_typed_seq.cpp =add_typed_seq.cpp=]] ]
[ [[@../../test/add_with_default_seq.cpp =add_with_default_seq.cpp=]] ]
[ [[@../../test/all_decl_seq.cpp =all_decl_seq.cpp=]] ]
[ [[@../../test/factorial_seq.cpp =factorial_seq.cpp=]] ]
[ [[@../../test/macro_commas_seq.cpp =macro_commas_seq.cpp=]] ]
[ [[@../../test/nesting_seq.cpp =nesting_seq.cpp=]] ]
[ [[@../../test/overload_seq.cpp =overload_seq.cpp=]] ]
[ [[@../../test/return_assign_seq.cpp =return_assign_seq.cpp=]] ]
[ [[@../../test/return_derivative_seq.cpp =return_derivative_seq.cpp=]] ]
[ [[@../../test/return_inc_seq.cpp =return_inc_seq.cpp=]] ]
[ [[@../../test/return_setget_seq.cpp =return_setget_seq.cpp=]] ]
[ [[@../../test/return_this_seq.cpp =return_this_seq.cpp=]] ]
[ [[@../../test/same_line_seq.cpp =same_line_seq.cpp=]] ]
[ [[@../../test/transform_seq.cpp =transform_seq.cpp=]] ]
[ [[@../../test/typeof_seq.cpp =typeof_seq.cpp=]] ]
[ [[@../../test/typeof_template_seq.cpp =typeof_template_seq.cpp=]] ]
]
[endsect]