Timeline for What Are The Differences Between Arduino Language and Standard C for MCU? [duplicate]
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 2, 2017 at 9:40 | history | closed |
Code Gorilla uint128_t jfpoilpret KIIV Enric Blanco |
Duplicate of C++ vs. The Arduino Language? | |
| Mar 14, 2017 at 17:07 | review | Close votes | |||
| Apr 2, 2017 at 9:40 | |||||
| Mar 14, 2017 at 16:47 | comment | added | Dmitry Grigoryev |
@TomCarpenter int main = 10; compiles perfectly fine in C. You will have trouble using standard library, but you can link directly to C runtime which has a different entry point (_start() in Linux and WinMain() in windows).
|
|
| Mar 14, 2017 at 16:43 | history | migrated | from electronics.stackexchange.com (revisions) | ||
| Mar 14, 2017 at 14:45 | comment | added | marcelm | @TomCarpenter Ah, I was under the impression that the Arduino IDE only dealt with C++ source files, potentially leading to the C/C++ issues mentioned above. Apparently I was wrong :) | |
| Mar 14, 2017 at 12:15 | comment | added | Tom Carpenter |
C files are compiled using avr-gcc, C++ files are compiled using avr-g++. The only thing you have to do to mix the two is to have #ifdef __cplusplus extern "C" #endif ... in header files that are shared between the C++ and C codes.
|
|
| Mar 14, 2017 at 12:10 | comment | added | Tom Carpenter |
@Lundin if you include a C file in the Arduino IDE, it will treat it as C. Having just tried it int new = 5 in a .c extension file compiles perfectly well...
|
|
| Mar 14, 2017 at 12:06 | comment | added | Lundin |
@TomCarpenter His point is that C is not C++. int new = 5; is perfectly valid C but invalid C++. More relevant, try compiling a C file that has VLAs, designated initializers, flexible array members, the _Generic keyword or other such C-specific features in it. C and C++ stopped being compatible languages somewhere around the year 1995, well over 20 years ago.
|
|
| Mar 14, 2017 at 11:37 | comment | added | Tom Carpenter |
@marcelm try loading a file that has int main = 10;. What's your point?
|
|
| Mar 14, 2017 at 10:50 | comment | added | marcelm |
@TomCarpenter Try loading a C file that has int new = 5; in it then ;)
|
|
| Mar 14, 2017 at 8:26 | comment | added | Tom Carpenter | @Lundin Arduino "IDE" supports C files quite happily. | |
| Mar 14, 2017 at 8:03 | answer | added | Lundin | timeline score: 7 | |
| Mar 14, 2017 at 7:55 | comment | added | Lundin | @m.Alin As far as I know, it supports C++ only. C and C++ are not compatible languages. | |
| Mar 14, 2017 at 7:30 | comment | added | m.Alin | There's really no such thing as the 'Arduino language'. The Arduino IDE supports C & C++ with some syntactic sugar added. | |
| Mar 14, 2017 at 7:17 | history | asked | deadguy88 | CC BY-SA 3.0 |