Ejemplo n.º 1
0
int my_function(int x) {
        printf("%d\n", x); 
        x = x + 1;
	if(x<10)
		my_function(x);
	return x;
}
Ejemplo n.º 2
0
static int __init
init_file(void)
{
	buff = (unsigned char* )kmalloc(1024*1024,GFP_KERNEL);
	if(buff != NULL)
	{
		printk("allocate 1M address space %p\n",buff);
	}
	else
		printk("error\n");
	memset(buff,'A',1024*1024);
	start_time = my_function();
	print(devname,buff);
	end_time = my_function();
	printk("The time survive is %ld us\n",end_time-start_time);//算出时间差
	return 0;
}
Ejemplo n.º 3
0
int main ( int argc, char **argv )
{
    my_function();
    
    LOG_ERROR("Message from main function logged.");
    
    return 0;
}
Ejemplo n.º 4
0
 U operator()(T t) const {
     AssertLive();
     ASSERT(!middle_my_id(t), "bad id value");
     ASSERT(!middle_is_ready(t), "Already ready" );
     U out;
     my_function(out);
     ++non_pointer_specialized_calls;
     return out;
 }
/*indicates whether or not a number is prime*/
int my_function(int n, int d){
  if (n/d == 1){
    return 1;
  }
  if (n % d == 0){
    return 0;
  }
  return my_function(n, d+1);
  }
Ejemplo n.º 6
0
 U* operator()(T my_storage) const {
     AssertLive();
     ASSERT(!middle_my_id(my_storage), "bad id value");
     ASSERT(!middle_is_ready(my_storage), "Already ready" );
     // allocate new space from buffers
     U* my_return = new(fetchNextBuffer()) U();
     my_function(*my_return);
     ++second_pointer_specialized_calls;
     return my_return;
 }
Ejemplo n.º 7
0
int  main(){
	printf("Main function.\n");

	my_function();

	printf("Back in function main.\n");

	return 0;

}
int my_function(int n, int x)
{
  if (x * x > n || n < 0) {
    return(-1);
  }
  if (x * x == n) {
    return(x);
  }
  return(my_function(n, x+1));
}
Ejemplo n.º 9
0
int main(){
	int
	       	b 
			= 
		
				my_function   ()
		
		
		;
	printf("%d\n",b);
	return 0;
}
Ejemplo n.º 10
0
 U operator()(T* my_storage) const {
     free_on_scope_exit<T> my_ptr(my_storage);  // free_on_scope_exit marks the buffer available
     AssertLive();
     if(my_storage) {  // may have been passed in a NULL
         ASSERT(!middle_my_id(*my_storage), "bad id value");
         ASSERT(!middle_is_ready(*my_storage), "Already ready" );
     }
     ++first_pointer_specialized_calls;
     U out;
     my_function(out);
     return out;
 }
Ejemplo n.º 11
0
int
main()
{
	my_function(
		1,
		2
	);

	make_test(
		42
	);
}
int is_prime_number(int n){
  if (n == -1){
    return 0;
  }
  if (n == 1){
    return 0;
  }
  if (n < 0){
    n = n * -1;
  }
  return my_function(n, 2);
}
Ejemplo n.º 13
0
 U* operator()(T* my_storage) const {
     free_on_scope_exit<T> my_ptr(my_storage);  // free_on_scope_exit marks the buffer available
     AssertLive();
     if(my_storage) {
         ASSERT(!middle_my_id(*my_storage), "bad id value");
         ASSERT(!middle_is_ready(*my_storage), "Already ready" );
     }
     // may have been passed a NULL
     ++pointer_specialized_calls;
     if(!my_storage) return NULL;
     ASSERT(!middle_my_id(*my_storage), "bad id value");
     ASSERT(!middle_is_ready(*my_storage), "Already ready" );
     U* my_return = new(fetchNextBuffer()) U();
     my_function(*my_return);
     return my_return;
 }
Ejemplo n.º 14
0
void sample::my_class::my_function()
{
  neam::r::function_call self_call(N_PRETTY_NAME_INFO("sample::my_class::my_function()"));

  try
  {
    my_function(true);
  }
  catch (std::exception &e)
  {
    self_call.fail(neam::r::exception_reason(N_REASON_INFO, e.what()));
  }
  catch (...)
  {
    self_call.fail(neam::r::exception_reason(N_REASON_INFO, "unknown exception caught"));
  }
}
int main()
{
	// Create a function pointer
	char (*my_function)(int) = int_to_char;

	// Call the function
	printf("%c\n", my_function(7));

	// Watch out for the weird syntax
	int ** (*pointless)(int *) = fake_2d_array;

	int * thing = NULL;
	if (pointless(thing) == NULL)
	{
		printf("It works!\n");
	}

	return 0;
}
Ejemplo n.º 16
0
sample::my_class &sample::my_class::operator=(const sample::my_class &o)
{
  neam::r::function_call self_call(N_PRETTY_FUNCTION_INFO(sample::my_class::operator=));

  if (this != &o)
  {
    value = o.value;

    try
    {
      my_function(get_top_value());
    }
    catch (std::exception &e)
    {
      self_call.fail(neam::r::exception_reason(N_REASON_INFO, e.what()));
    }
    catch (...)
    {
      self_call.fail(neam::r::exception_reason(N_REASON_INFO, "unknown exception caught"));
    }
  }
  return *this;
}
	my_struct(Args... args) : value(my_function(args...)) { }
Ejemplo n.º 18
0
 data__ operator()(const data__ &x) const
 {
   return my_function(x);
 }
int my_function(Arg0 arg0, Args... args) {
	(void)arg0;
	return my_function(args...);
}
int main(int argc, char** argv) {
	int i = 0;
	my_function(1);
	assert(0);
}
Ejemplo n.º 21
0
int main() 
{
	int x=0;
	my_function(x);
        return 0;
}
int square_root(int n)
{
  return(my_function(n, 0));
}