home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !gcc / examples / Examples
Encoding:
Text File  |  2004-01-07  |  2.2 KB  |  88 lines

  1. RISC OS GCC example applications
  2. ================================
  3.  
  4. The following example programs are designed to demonstrate the basics
  5. of the C and C++ languages and help the user understand the GCC compilers.
  6. For each program, there is a list of the necessary command lines for how
  7. to compile, link and run the program.
  8.  
  9.  
  10. hellow
  11. ------
  12.  
  13. The standard C program.
  14.  
  15. Source:     c.hellow
  16. Compile using:     gcc hellow.c -o hellow
  17. Run using:     hellow
  18.  
  19.  
  20. ackermann
  21. ---------
  22.  
  23. A benchmark program, used to indicate the coding efficiency of procedures.
  24. Also illustrates how to receive arguments passed on the command line.
  25.  
  26. Source:        c.ackermann
  27. Compile using:    gcc ackermann.c -o ackermann
  28. Run using:    ackermann 3 4
  29.  
  30. Try using different numbers instead of 3 and 4.
  31.  
  32.  
  33. Dhrystone 2.1
  34. -------------
  35.  
  36. Used as the standard integer benchmark. This program consists of two
  37. source files which will need linking together. The best solution is to
  38. compile each file separately, for which the resultant Acorn Object Format
  39. files will be placed in the 'o' directory, and then link with the necessary
  40. libraries to create an executable.
  41.  
  42. Source:        c.dhry_1, c.dhry_2, h.dhry_2
  43.  
  44. Compile using:    gcc -c dhry_1.c
  45.         gcc -c dhry_2.c
  46.  
  47. Link using:    gcc -o dhry dhry_1.o dhry_2.o
  48.  
  49. Run using:    dhry
  50.  
  51. When prompted for the number of iterations, use any number in the range
  52. 10000 to 200000.  It might be worth adding the command line option '-O2'
  53. when compiling to measure the difference achieved between no optimisation
  54. and full optimisation.
  55.  
  56.  
  57. helloworld
  58. ---------
  59.  
  60. The standard C++ program.  We use the g++ driver to build and link C++
  61. applications.  This does nothing more than adding -lstdc++ to the linker
  62. command line.
  63.  
  64. Source:     cc.helloworld
  65. Compile using:     g++ helloworld.cc -o helloworld
  66. Run using:     helloworld
  67.  
  68. exception
  69. ---------
  70.  
  71. A demonstration of basic exception handling.  The application
  72. calls a function that throws a string as an exception which will
  73. be caught by the calling function.
  74.  
  75. Source:         cc.exception
  76. Compile using:  g++ exception.cc -o exception
  77. Run using:      exception
  78.  
  79.  
  80. template
  81. --------
  82.  
  83. Demonstrates the instantiation of templates.
  84.  
  85. Source:     cc.template
  86. Compile using:     g++ template.cc -o template
  87. Run using:     template
  88.