goto_seq.cpp 567 B

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