OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [objc/] [execute/] [nested-func-1.m] - Rev 384

Compare with Previous | Blame | View Log

/* Test basic nested C function functionality within ObjC
   methods.  */
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
#include <stdio.h>
#include <stdlib.h>
#import "../../objc-obj-c++-shared/Object1.h"
#include <objc/objc.h>
 
int bappy (int (*blargh) (int a, int b, int c))
{
  return blargh (4, 7, 2) + 3;
}
 
@interface Foo: Object
+ (int)foo;
@end
 
@implementation Foo
+ (int)foo
{
  int blargh (int a, int b, int c)
  {
    return a * b + c;
  }
  return bappy (blargh);
}
@end
 
int main () 
{
  int f = [Foo foo];
  if (f != 33)
    abort ();
 
  return 0;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.