Re: is OO any use?

Daniel Serpell <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.gnupic
Message-ID <[email protected]>
Hi!

El Fri, Aug 19, 2005 at 02:24:06PM +1200, David McNab escribio:
> Hi,
> 
[...]
> 
> What I'm asking here is - is there any real practical value to be gained
> from supporting OOP in a PIC runtime environment?

There are many levels of OOP support, I think that some of them are
really useful:

* Inheritance: I think that static inheritance (ie, no virtual
               functions) is really usefull. You could do thinks like
               (in C++/Java like syntax)

      class myUART : extends picUART {
        protected void init() {
          baud=9600;
          parity=picUART.parity.none;
        }
        protected void recive(char c) {
          // Do something with "c"
        }
      }
   
   This type of code could be compiled to something very efficient,
   including support for different types of UART's depending on the
   target chip.

* Polymorphism: This is usefull to write code that can be compiled
   with different types. For example, an algorithm can accept 8 bit
   integers and 16 bit integers, etc.
  
  Again, I think that in a microcontroller environment, only static
  polymorphism is usefull, so the compilar determines which code to
  use at compile time, with no runtime overhead.


        Daniel.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.