What is c++ and oop c++

Discussion in 'Programmer's Corner' started by TAKYMOUNIR, Aug 3, 2011.

  1. TAKYMOUNIR

    Thread Starter Active Member

    Jun 23, 2008
    351
    1
    Is there is big different between c++ and object oriented programming by c++ and which one is usefull for pic microcontroller and also can i use oop by c# for pic microcontroller
     
  2. kavli

    New Member

    Aug 1, 2011
    23
    2
    C++ is a language that is based on C.
    The difference between them is generally that C++ supports object oriented programming. Still there is no problem to write programs in a procedural way using C++.

    As far as I know there are no C++ compilers for the PIC family. It is generally hard to write compilers for the PIC, since it has few registers and additionally the smaller PICs have very shallow stacks, which makes it even harder to write effective compilers, object oriented or not.

    If you want to program microcontrollers using C++, your best option is probably Atmels AVR range of processors.

    -- K
     
    Last edited: Aug 3, 2011
    TAKYMOUNIR likes this.
  3. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    C++ is a programming language. OOP (object oriented programming) is a programming paradigm. C++ supports a number of programming paradigms, such as OOP, procedural, and straight declarative. With add-on libraries, a number of other paradigms can be supported. I've heard of at least one C++ compiler for PIC microcontrollers, but I haven't investigated -- even though I'd love to use C++ to program microcontroller projects. At least for the smaller microcontrollers, the higher-level language support for things like C and C++ tend to be pretty sparse and you have to learn to live within the limitations, especially if you're used to a general-purpose programming environment like, say, g++ on 32 or 64 bit platforms.

    Can't help you with the C# part of your question -- I break out in hives when I get near anything invented by Microsoft... However, my guess would be there is little support for C# in the embedded world (for the folks who love to correct others, note I said little, not none :p).
     
    TAKYMOUNIR likes this.
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    c# is a Mircosoft product for use with Windows. No go for PICs.

    Here is at least one implementation of C++ for PICs.

    I've had no issues using straight ANSI C on PICs. You can do object-like coding if you wish. There's nothing special about objects anyway, I used to create them in assembly.

    BTW, generally the size of the hardware stack is of no matter when using a compiler as they build their own soft stacks. Higher level PICs even have some hardware aids for this (lets you read & write to the top of the stack).
     
    TAKYMOUNIR likes this.
  5. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Their is no C++ without OOP,if you remove the OOP from the language it becomes C.You can view C++ as a super set and C as a sub set of C++.The developer of C++ "Bjarne Stroustrup" added OPP to C to develop C++ that was all, although it started that way,even the name of C++ before standardization was "C with Classes”. Any way thats a big history....

    Now comes the C its a structured programming language, and its the best system level language (still at 2011 I think so) by system level I mean it can communicate with hardware in the most efficient way than any other language, that’s the reason it is used in embedded applications.

    For embedded application like mcu programming you don't need OOP,OOP is quite complex and used in complex platform like under operating systems in application softwares for example the application runs under Windows, Linux or Mac will need OOP as if you program it using any structured programming language like C then you will come across many problems.OOP just make it easier for us programmers to program complex code efficiently ,easily and in less time.

    Now C# ,it targets CLR i.e.. common language runtime ,C# programs can't be directly processed by any processor or micro controller, they needs a kind of system software that will convert their managed code into native language that is understood by any microprocessor or microcontroller, .Net(Dot Net) is the runtime (system software) which actually does this ,so in simple words you need .net runtime to run any C# application. Normally it is done with Java, you will find java runtime under mobile phones, TV set top box and many more embedded application but their main framework is written using C or mixture of C and assembly...

    Microchip's PIC can't execute MSIL (Microsoft Intermediate Language) i.e.. the code format inside of C# applications.PIC only understand PIC assembly which can be produced by any PIC assembler or C compiler.

    Good Luck
     
    TAKYMOUNIR likes this.
Loading...