MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/277lgr/micro_python_python_for_microcontrollers/chyjotv/?context=3
r/programming • u/[deleted] • Jun 03 '14
116 comments sorted by
View all comments
Show parent comments
11
ANSI C
This is basically a lie. ANSI C is recognized (for compilers and most everyone else) to be C89. The Makefile uses these options:
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)
Funnily enough, for gcc -ansi means:
In C mode, this is equivalent to -std=c90. In C++ mode, it is equivalent to -std=c++98.
So he overrides -std=c90 with -std=gnu99 in the next argument. If you try to compile with -pedantic, you get a whole slew of errors.
This code is not ANSI C.
4 u/[deleted] Jun 04 '14 [removed] — view removed comment 10 u/batrick Jun 04 '14 Because C99 does not compile on many microcontrollers (i.e. what this project is targeting). C89 compiles almost everywhere. 1 u/[deleted] Jun 04 '14 [removed] — view removed comment 0 u/[deleted] Jun 04 '14 [deleted] 1 u/[deleted] Jun 04 '14 Arduino is based on gcc. gcc has supported C99 for decades. If the Arduino IDE doesn't support it, it's just plain old broken. 1 u/[deleted] Jun 04 '14 He's tested it on gcc, which supports C99 with no problems.Shitty commercial C compilers may not, but really, I wouldn't use a microcontroller which gcc doesn't support, exactly for that reason. 1 u/fullouterjoin Jun 04 '14 edited Jun 04 '14 Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.
4
[removed] — view removed comment
10 u/batrick Jun 04 '14 Because C99 does not compile on many microcontrollers (i.e. what this project is targeting). C89 compiles almost everywhere. 1 u/[deleted] Jun 04 '14 [removed] — view removed comment 0 u/[deleted] Jun 04 '14 [deleted] 1 u/[deleted] Jun 04 '14 Arduino is based on gcc. gcc has supported C99 for decades. If the Arduino IDE doesn't support it, it's just plain old broken. 1 u/[deleted] Jun 04 '14 He's tested it on gcc, which supports C99 with no problems.Shitty commercial C compilers may not, but really, I wouldn't use a microcontroller which gcc doesn't support, exactly for that reason. 1 u/fullouterjoin Jun 04 '14 edited Jun 04 '14 Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.
10
Because C99 does not compile on many microcontrollers (i.e. what this project is targeting). C89 compiles almost everywhere.
1 u/[deleted] Jun 04 '14 [removed] — view removed comment 0 u/[deleted] Jun 04 '14 [deleted] 1 u/[deleted] Jun 04 '14 Arduino is based on gcc. gcc has supported C99 for decades. If the Arduino IDE doesn't support it, it's just plain old broken. 1 u/[deleted] Jun 04 '14 He's tested it on gcc, which supports C99 with no problems.Shitty commercial C compilers may not, but really, I wouldn't use a microcontroller which gcc doesn't support, exactly for that reason. 1 u/fullouterjoin Jun 04 '14 edited Jun 04 '14 Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.
1
0 u/[deleted] Jun 04 '14 [deleted] 1 u/[deleted] Jun 04 '14 Arduino is based on gcc. gcc has supported C99 for decades. If the Arduino IDE doesn't support it, it's just plain old broken. 1 u/[deleted] Jun 04 '14 He's tested it on gcc, which supports C99 with no problems.Shitty commercial C compilers may not, but really, I wouldn't use a microcontroller which gcc doesn't support, exactly for that reason. 1 u/fullouterjoin Jun 04 '14 edited Jun 04 '14 Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.
0
[deleted]
1 u/[deleted] Jun 04 '14 Arduino is based on gcc. gcc has supported C99 for decades. If the Arduino IDE doesn't support it, it's just plain old broken.
Arduino is based on gcc. gcc has supported C99 for decades. If the Arduino IDE doesn't support it, it's just plain old broken.
He's tested it on gcc, which supports C99 with no problems.
Shitty commercial C compilers may not, but really, I wouldn't use a microcontroller which gcc doesn't support, exactly for that reason.
1 u/fullouterjoin Jun 04 '14 edited Jun 04 '14 Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.
Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.
11
u/batrick Jun 03 '14
This is basically a lie. ANSI C is recognized (for compilers and most everyone else) to be C89. The Makefile uses these options:
Funnily enough, for gcc -ansi means:
So he overrides -std=c90 with -std=gnu99 in the next argument. If you try to compile with -pedantic, you get a whole slew of errors.
This code is not ANSI C.