Example #1
0
int func1()
{
  DBUG_ENTER("func1");
  func2();
  if (push1)
  {
    DBUG_PUSH(push1);
    fprintf(DBUG_FILE, "=> push1\n");
  }
  DBUG_RETURN(10);
}
Example #2
0
int main() {
	int a,b,c;
	a = 1;
	b = 2;
	a = a + func1(b);

	c = 100;
	func1(c);
	c = 200;
	func2(c);
}
Example #3
0
int sigfoo3 (int c)
{
  signal (SIGALRM, handler);
  alarm (1);
  ++count; /* first */
  alarm (1);
  ++count; /* second */
  func1 ();
  alarm (1);
  func2 ();
  sleep(2);
}
Example #4
0
int main()
{
  char len[8]="ASDESFP";
  data *bob=(data *)malloc(sizeof(data));
  if(bob!=NULL)
  {
     bob->age=3;
     bob->string=len;
  }
  func2(bob);
  return 1;
}
Example #5
0
int main()
{
	UndefMgr* mgr = new UndefMgr;
	int (*func)() = (int(*)()) mgr->generateNew("TestFunction");
	int (*func2)() = (int(*)()) mgr->generateNew("TestFunction2");
	
	func();
	func2();
	
	delete mgr;
	return 0;
}
Example #6
0
main ()
{
#ifdef usestubs
  set_debug_traps();
  breakpoint();
#endif
  func1 ();
  printf("in main after func1\n");
  tmp2 = func2 ();
  tmp3 = func3 ();
  printf("exiting\n");
}
Example #7
0
int main(){
    Boo boo; 
    boost::function2<void, int, int> func, func2, func3;
    func= boost::bind(&Boo::f, &boo, _1, _2);
    func(13, 7);
    func2= boost::bind(f2, _1, _2);
    func2(13, 7);
    func3 = &f2;
    func3(1,2);

    return 0;
}
Example #8
0
//此程序表达为什么尽量用int替代char
int main(int argc, const char *argv[])
{
	char val;
	val = func1('b');
	printf("%c\n", val);

	char tmp;
	tmp = func2();
	printf("%d\n", tmp);

	return 0;
}
Example #9
0
int main(void)
{
    int n;
    size_t m;
    n = func1(1, 2, 3, 4, 5, 6);
    printf("%d\n", n);
    m = func2(1, 2, 3, 4, 5, 6);
    printf("%d\n", (int)m);
    m = func3(5, 2, 3, 4, 5, 6);
    printf("%d\n", (int)m);
    return 0;
}
Example #10
0
static double func4_2_0(const double x[], const int iResponse)
{
    if (iResponse == 0)
        return func4(x, iResponse);
    else  if (iResponse == 1)
        return func2(x, iResponse);
    else  if (iResponse == 2)
        return func0(x, iResponse);
    else
        error("bad iResponse");
    return 0;
}
Example #11
0
main ()
{
  thds = omp_get_max_threads ();
  if (thds == 1) {
    printf ("should be run this program on multi threads.\n");
    exit (0);
  }
  omp_set_dynamic (0);


  prvt = MAGICNO;
  #pragma omp parallel firstprivate (prvt)
  {
    int	id = omp_get_thread_num ();

    if (prvt != MAGICNO) {
      #pragma omp critical
      errors += 1;
    }

    prvt = id;

    #pragma omp barrier
    if (prvt != id) {
      #pragma omp critical
      errors += 1;
    }
    if (sizeof(prvt) != sizeof(float)) {
      #pragma omp critical
      errors += 1;
    }
  }


  prvt = MAGICNO*2;
  #pragma omp parallel firstprivate (prvt)
  func1 (MAGICNO*2, &prvt);


  prvt = MAGICNO*3;
  #pragma omp parallel firstprivate (prvt)
  func2 (MAGICNO*3);


  if (errors == 0) {
    printf ("firstprivate 011 : SUCCESS\n");
    return 0;
  } else {
    printf ("firstprivate 011 : FAILED\n");
    return 1;
  }
}
Example #12
0
void func2(int n)
{
	int i;
	if(n==0)
		return;
    else
	{
		for(i=1; i<=n; i++)
			printf("%d ",i);
        printf("\n");	
		func2(n-1);
	}
}
Example #13
0
int main() {
  Function<int(double)> func1 = f;
  std::cout << func1(3.14) << std::endl;

  Function<void(C&)> func2 = &C::g;
  C c;
  func2(c);

  Function<bool(int)> func3 = std::bind2nd(std::less<int>(), 10);
  std::cout << func3(15) << std::endl;

  return 0;
}
Example #14
0
void vec5(float *a, float *b, float *c, int off, int len)
{
  int i; 
  //simd aligned(a:64, b:64) simdlen(64)
  #pragma omp parallel for 
  for(i = 0; i < len; i++)
  {
    a[i] = func1(a[i],b[i]);
    b[i] = func1(b[i],c[i]);
    c[i] = func1(c[i],b[i]);

    a[i] = func2(a[i],b[i],c[i],off);
    b[i] = func2(b[i],a[i],c[i],off);
    c[i] = func2(c[i],b[i],a[i],off);
        off++;
    if (off == 1000 ) { off=1;}
  }

  /*  for(k = 0; k < 1000; k++) {

      a[i] += (sin(cos(a[i])) > 2.34) ? 
      a[i] * atan(b[i]) :
      a[i] + cos(sin(b[i]));

      b[i] += (sin(cos(b[i])) > 5.34) ? 
      b[i] * atan(c[i]) :
      b[i] + cos(sin(c[i]));

      c[i] += (sin(cos(c[i])) > 8.34) ? 
      c[i] * atan(b[i]) :
      c[i] + cos(sin(b[i]));

      a[i] = a[i]*off + b[i]*(off/3) + c[i]*(off/5);
      b[i] = c[i]*off + b[i]*(off/3) + a[i]*(off/5);
      c[i] = b[i]*off + a[i]*(off/3) + c[i]*(off/5);
    }
  */

}
Example #15
0
int func1(int x, int y) {
    int a, b;
    register char * const basepointer __asm("rbp");
    register char * const stackpointer __asm("rsp");
    printf("In func1\n");
    //printf("func1 frame address (0) %p\n", __builtin_frame_address(0));
    //printf("func1 frame address (1) %p\n", __builtin_frame_address(1));
    //printf("func1 rbp %p\n", basepointer);
    //printf("func1 rsp %p\n", stackpointer);
    //printf("func1 stack frame size = 0x%x\n", basepointer - stackpointer);
    printf("&a = %p, &b = %p\n", &a, &b);
    return func2(x, y);
}
Example #16
0
void homework()
{
	char s[]="1234";
	func1(s);
	// func1("1234"); // 不能使用这种方式,因为在函数内部要修改形参的内容,这样调用相当于实参是一个字符串常量,不能修改。
	printf("%s\n",s);
	printf("%lf\n",func2(5));
	func3("ABCa12cD 123");

	//m1();
	//printf("sum=%f",Result(5.0));
	printf("sum=%f",f(5));
}
Example #17
0
void main()
{
    func();
    printf("A = %d\n", a);

    {
        static int a = 10;
        printf("A = %d\n", a);
    }

    printf("A = %d\n", a);
    func2();
}
Example #18
0
int main(int argc, const char *argv[])
{
	void (*f)(int);
	f = func2(func1);
	f(777);

	printf("---------------------\n");


	f = func3(111, func1);
	f(888);

	return 0;
}
Example #19
0
File: 2013.c Project: qvil/C
void main()
{
    int *b, c, d;
    int a[5] = {1, 3, 5, 7, 9};

    b = a;
    printf("*b+3 : %d\n", *b+3);
    printf("*(b+3) : %d\n", *(b+3));

    c = func1(5,3);
    printf("c : %d\n", c);
    d = func2(3);
    printf("d : %d\n", d);
}
Example #20
0
int main()
{
  int q = 0;

  func2 (&q);
  global2++;

  while (1)
    {
      func(&q);
    }

  return 0;
}
Example #21
0
int func1()
{
    Test1 test;
    test = func2();

    if (test.v[0] != 10)
        abort ();
    if (test.v[1] != 20)
        abort ();
    if (test.v[2] != 30)
        abort ();
    if (test.v[3] != 40)
        abort ();
}
Example #22
0
int
func1 ()
{
  /* The point of this is that we will set a breakpoint at this call.

     Then, if DECR_PC_AFTER_BREAK equals the size of a function call
     instruction (true on a sun3 if this is gcc-compiled--FIXME we
     should use asm() to make it work for any compiler, present or
     future), then we will end up branching to the location just after
     the breakpoint.  And we better not confuse that with hitting the
     breakpoint.  */
  func2 ();
  return 73;
}
Example #23
0
void inits() {
	X a( 12 ); // direct init
	X b = 12; // copy init
	func1( 12 ); // ==>ERROR (often not diagnosed by comiler): copy init of formal argument
	func2( a ); // no copy: direct initialization of a temporary X, and binding a reference
	a = b; // ==>ERROR: copy assignment
	a = 12; // ==>ERROR: implicit conversion: direct init of temp, assignment, destruction of temp
	a = X(12); // ==>ERROR: explicit conversion: same result
	X c = func3(); // ==>ERROR: copy initialization of c
	X d( func3() ); // ==>ERROR: copy initialization of d
	a = func3(); // ==>ERROR: copy init of temporary and assignment to a
	X e = func4(); // ==>ERROR (often not diagnosed by compiler): copy initialization of e
	X f( func4() ); // direct initialization of f
}
Example #24
0
int main()
{
	int i = -1;
	while( i < 1)
	{
		i = func2(i);
		i++;
		if (0 == i)
		{
			continue;
		}
	}
	return 0;
} 
Example #25
0
int main(int argc, char **argv)
{
    //c = 40;
    //printf("c = %d\n", c);

    int i = 0;
    
    for(i = 0; i < SIZE; ++i){
        func1();
        func2();
    }

    return 0;
}
Example #26
0
int main(void)
{
	double x; //Displacement
	double v; //Speed
	double t; //Time
	double h; //=dt
	double kx1,kv1;
	double kx2,kv2;
	double kx3,kv3;
	double kx4,kv4;
	int n=NDIV;

	h=2.0*M_PI*sqrt(k/m)/n;
	x=1.0;
	v=0.0;
	printf("#t     x      v\n");
	for(int i=0;i<=n;i++){
		t=h*i;
		printf("%2d %.4f %9.4f %9.4f\n",i,t,x,v);
		kx1=h*func1(t,v,x);
		kv1=h*func2(t,v,x);

		kx2=h*func1(t+h/2.0,x+kx1/2.0,v+kv1/2.0);
		kv2=h*func2(t+h/2.0,x+kx1/2.0,v+kv1/2.0);

		kx3=h*func1(t+h/2.0,x+kx2/2.0,v+kv2/2.0);
		kv3=h*func2(t+h/2.0,x+kx2/2.0,v+kv2/2.0);

		kx4=h*func1(t+h,x+kx3,v+kv3);
		kv4=h*func2(t+h,x+kx3,v+kv3);

		x=x+1.0/6.0*(kx1+2*kx2+2*kx3+kx4);
		v=v+1.0/6.0*(kv1+2*kv2+2*kv3+kv4);
	}

	return 0;
}
Example #27
0
main ()
{
  thds = omp_get_max_threads ();
  if (thds == 1) {
    printf ("should be run this program on multi threads.\n");
    exit (0);
  }
  omp_set_dynamic (0);


  #pragma omp parallel private(prvt)
  {
    int	id = omp_get_thread_num ();

    prvt.i = id;
    prvt.d = id+1;
    #pragma omp barrier

    if (prvt.i != id) {
      #pragma omp critical
      errors += 1;
    }
    if (prvt.d != id+1) {
      #pragma omp critical
      errors += 1;
    }
    if (sizeof(prvt) != sizeof(struct x)) {
      #pragma omp critical
      errors += 1;
    }
  }


  #pragma omp parallel private(prvt)
  func1 (&prvt);


  #pragma omp parallel private(prvt)
  func2 ();


  if (errors == 0) {
    printf ("private 013 : SUCCESS\n");
    return 0;
  } else {
    printf ("private 013 : FAILED\n");
    return 1;
  }
}
Example #28
0
main ()
{
  thds = omp_get_max_threads ();
  if (thds == 1) {
    printf ("should be run this program on multi threads.\n");
    exit (0);
  }
  omp_set_dynamic (0);


  shrd = 0;
  #pragma omp parallel shared(shrd)
  {
    #pragma omp critical
    {
      shrd += 1;
    }

    #pragma omp barrier

    if (shrd != (int *)(thds * sizeof(int))) {
      #pragma omp critical
      errors += 1;
    }
    if (sizeof(shrd) != sizeof(int *)) {
      #pragma omp critical
      errors += 1;
    }
  }


  shrd = 0;
  #pragma omp parallel shared(shrd)
  func1 (&shrd);


  shrd = 0;
  #pragma omp parallel shared(shrd)
  func2 ();


  if (errors == 0) {
    printf ("shared 015 : SUCCESS\n");
    return 0;
  } else {
    printf ("shared 015 : FAILED\n");
    return 1;
  }
}
Example #29
0
int main(void)
{
    int k;
    int i;

    for (k=0; k<10; k++) {
        i = func1();
        func2();
    }
    k = 100;
    printf("i = :%d\n", i);
    printf("j = :%d\n", j);

    return 0;
}
Example #30
0
int main(int argc, char const *argv[])
{
  struct student s = {1,2,3};

  printf("%d, %d, %d\n", s.a, s.b, s.c);
  printf("%p, %p, %p\n", &s, &(s.b), &(s.c));
  printf("%d, %d, %d\n", &s, &(s.b), &(s.c));

  func(&s);

  float f = 0.1;
  double d = f;
  func2(&d);
  return 0;
}