Function with two or more entry point

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is possible to make function that have two or more entry points?
Something like this:

#include <stdio.h>

void test_print1()
{
  printf("print1\n");
  void test_print2()
  {
    printf("print2\n");
  }
}

int main ()
{
  test_print1();
  test_print2();

  return 0;
}

I also tried this:

#include <stdio.h>
#include <stddef.h>

void test_print1()
{
  entry0:
  printf("print1\n");
  entry1:
  printf("print2\n");
}

const ptrdiff_t ent1_m_ent0 =  (&&entry1 - &&entry0);

int main ()
{
  test_print1();
  (*(void(*)())(char *)(test_print1)+ ent1_m_ent0 )();
  return 0;
}

... but it doesn't work


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux