1 | |
---|---|
2 | // Copyright (C) 2009-2012 Lorenzo Caminiti |
3 | // Distributed under the Boost Software License, Version 1.0 |
4 | // (see accompanying file LICENSE_1_0.txt or a copy at |
5 | // http://www.boost.org/LICENSE_1_0.txt) |
6 | // Home at http://www.boost.org/libs/local_function |
7 | |
8 | #include <boost/local_function.hpp> |
9 | |
10 | int error(int x, int y) { |
11 | int BOOST_LOCAL_FUNCTION( (int z) ) { |
12 | if(z <= 0) goto failure; |
13 | else goto success; |
14 | success: |
15 | return 0; |
16 | } BOOST_LOCAL_FUNCTION_NAME(validate) |
17 | |
18 | return validate(x + y); |
19 | failure: |
20 | return -1; |
21 | } |
22 | |
23 | int main(void) { |
24 | error(x: 1, y: 2); |
25 | return 0; |
26 | } |
27 | |
28 |