A Place Where No Dreams Come True...

Current Topic: The C programming language is closely related to the native operations that a processor performs naturally. Therefore it is an Ideal environment for programming embedded controllers. Like the AVR compatible family of processors.

Fortunately The Arduino Environment Supports Regular C...

Actually... The Arduino is based on GNU AVR tools. The make system. The programmer. And the core libraries. All written in C and run as native programs called by Arduino scripts are the core of the Arduino development environment. The most important concept to understand here is that code written in C is accessible to C++ and even Assembly. Assembly code is Accessible to C and to C++. The final point is that C++ code nor any another abstracted programming language is accessible to C or Assembly.

For those of you who want to become serious programmers take note: It would not be possible to have tools such as interpreters (PHP, JAVA, BASIC, etc...) codecs (MP3, DIVX, VPX, etc) etc... Across applications let alone platforms except for the fact that the libraries shared between them are available in a fundamental form that is usable by all. C being that lowest common denominator. So to speak.

Should All Code Be Written In C...

Obviously not. C is no different then say PHP or JAVA. The difference being that it is compiled. Not interpreted. Interpreted code relies on compiled code to operate. That is the distinction. Furthermore, as stated, compiled C code is available to and is what is primarily used by interpreters. Through the use of Libraries. And most of these interpreters are primarily written in Abstract languages like C++.

I hope I clarified that properly. Ha ha!

So What's The Reality...

There are two methods for including C code (libraries) into the C++ template that the Arduino environment provides naturally. My quick-and-dirty approach is to just include the file I want as a C++ (.CPP) file with noting but raw C code in it. In this case the compiler generates machine code that would be expected from proper C programming with no additional overhead. It may still be possible to include the file as a C file (.C) but would require the 'extern "C" { etc... }' preprocessor directive in the referenced interface (header) file (.h)

10448