Object Oriented C - ooc

Not looking for this?

There are some other projects with similar names.
See them!

Download

Download latest source code and documentation from sourceforge.net.

Tutorial

Tutorial in downloadable PDF.

Online tutorial.

Documentation

Online documentation.

Licensing

ooc is licensed under LGPL 3.

Sourceforge.net

ooc project page.

Get help.

Contact

If you've been lost, just contact me at old-fashioned (at) users.sourceforge.net.

ooc programmning language is a different project!

Object Oriented C (ooc) kit is for those who want to program in an object orieneted manner, but stick on the good old C as well. ooc implements classes, single and multiple inheritance, exception handling. Ideal for students getting to know OO programming in pure C.

It can be mainly useful for education and for small systems that lack C++ compiler. Althoug I have written quite complex programs using ooc!

By the help of ooc you can write object oriented code in C with little efforts, though you must understand the underlying object model.

Creating ooc my main goal was to develop a lightweight object model, that provides many features of C++ but is pure ANSI-C. Thus this is highly portable even for small embedded systems as well. On other hand it was kind a "proof of concept" and a hobby.

ooc is mature enough to be ported onto small microcontrollers, PICs, or DSPs.

ooc logo

ooc is like giving a good old steam locomotion a new life! :-)

Features

  • Uses only C macros and functions, no language extensions required! (ANSI-C)
  • Easy to read source code for your application. Care was taken to make things as simple as possible.
  • Single inheritance of classes
  • Multiple inheritance by interfaces and mixins (since version 1.3)
  • Implementing exceptions (in pure C!)
  • Virtual functions for classes
  • External tool for easy class implementation

Comparison

There are some other object models in C as weel. They may be worth a try. The mostly known is GObject, that is a very sophisticated system, but requires lot of typing, and subclassing is labor-intensive.

A short comparison table may help understand the key differences:

Feature
ooc
GObject
C++
Class inheritance
+
+
+
Multiple inheritance: interfaces
+

+
Multiple inheritance: mixins
+

+
Run-time type safety
+
+
(optional)
Exception handling
+
try ... catch .. finally

+
try ... catch
Managed pointers
+
ooc_manage, ooc_pass

+
std::auto_ptr<>()
Operator overloading


+
Function / method overloading


+
Properties

+

Compile time private / protected / public check
so-so

+
Broad range of containers, utilities
lacks many :-(
but Glib can be used!
many (Glib)
many (STL, Boost)

Currently supported compilers / platforms

  • GNU GCC 4.x on Linux (with automake tools as well)
  • Microsoft Visual C++ 2008 (Express edition as well)
  • MPLAB C18 for the Microchip 8 bit PIC families (runs on windows)
  • MPLAB C30 for the Microchip 16 bit PIC families (runs on windows)
  • MPLAB C32 port for the Microchip 32 bit PIC families (runs on windows)

Development roadmap

The following features are planned to be implemented in the near future:
  • some speed and space optimizations in the core libraries
  • more containers (singly linked list, fifo, stack, trees)

Projects with similar names

THIS ooc is a set of C macro collection and a small C library!
Unfortunately shares the name with some other projects of similar purpose.
Shall you be interested in those, you can find them here:

ooc programming language
(that is a LANGUAGE and a compiler called rock)
http://ooc-lang.org/
A good book introducing the concept and the related ooc C PREPOCESSOR
www.cs.rit.edu/~ats/books/ooc.pdf
www.cs.rit.edu/~ats/books/ooc-02.01.04.tar.gz

Happy ooc-coding!

Document made with KompoZer

Latest

2012. 01. 09.
  • Introducing multiple inheritance:
    • interfaces
    • mixins

2011. 08. 10.
  • MPLAB C32 port
2011. 08. 06.
  • MPLAB C30 port
2011. 08. 02.
ooc is listed on Softpedia.

2011. 07. 31.
Version 1.1 is available:
  • MPLAB C18 port
2011. 04. 17
Version 1.0 is available:
  • Licensing changed to LGPL v3
  • Support for Unit testing
2010. 06. 19
Version 0.9.g is available:
  • Multithreading support
  • Easier porting
2010. 05. 12
Version 0.9.f is available.

Version 0.9.e is available.