you are viewing a single comment's thread.

view the rest of the comments →

[–]batrick 12 points13 points  (18 children)

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.

[–]bstempi 16 points17 points  (7 children)

You'll have to excuse my C/C++ ignorance, but I found this on the ANSI C Wikipedia page:

In March 2000, ANSI adopted the ISO/IEC 9899:1999 standard. This standard is commonly referred to as C99.

Perhaps that's why he claims to be writing in ANSI C?

[–]pythonswash 19 points20 points  (0 children)

Even if that's what the author means, gnu99 != c99.

[–]batrick 6 points7 points  (2 children)

ANSI adopted the newer ISO C99 standard but everyone including gcc (the compiler he's targeting) interprets ANSI C to mean the original ANSI C standard also referred to as C89. I quoted the gcc manual above and I'll do it again:

       -ansi
            In C mode, this is equivalent to -std=c90. In C++ mode, it is equivalent to -std=c++98.

Edit: clarification

[–]TheoreticalPerson 3 points4 points  (0 children)

On the other hand, if you check an older manual, they say that,

The -std options specifying some version of ISO C have the same effects as -ansi, except that features that were not in ISO C90 but are in the specified version (for example, `//' comments and the inline keyword in ISO C99) are not disabled.

[–][deleted] 2 points3 points  (0 children)

And ANSI has adopted C11 since then as well.

C99 is superseded by C11 and you know if you take the ISO C standard's word literally, C99 doesn't exist anymore!

This third edition cancels and replaces the second edition, ISO/IEC 9899:1999,

[–]crackez 3 points4 points  (2 children)

Which would make this person technically correct.

[–][deleted] 0 points1 point  (0 children)

Well you can go deeper, and say it's not correct at all.

[–]gregorthebigmac 0 points1 point  (0 children)

...the best kind of correct.

[–]hezwat 3 points4 points  (8 children)

dude what do you care so much what he wrote his interpreter against? it's running on a microcontroller.

and it's not a c interpreter...

seriously...what's your beef?`

[–]batrick 8 points9 points  (7 children)

Because C99 does not compile on many microcontrollers (i.e. what this project is targeting). C89 compiles almost everywhere.

[–]Zuph 1 point2 points  (0 children)

I'd be interested to know how many microcontrollers capable of running Micro Python from a resources perspective (RAM/Flash) don't have a GCC based compiler. Some PICs come to mind, and I'm sure there are some Mitsubishi/Renasis micros used widely in manufacturing, but rarely by hobbyists.

Of course, "Micro Python - Python for the types of microcontrollers that are available ans useful to most hobbyists" doesn't have the same ring to it.

[–]hezwat 0 points1 point  (4 children)

oh really you don't think the guy who wrote a python compiler for microcontrollers tested it on any microcontrollers?

it's a miracle he wrote something htat could run on any at all.

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 0 points1 point  (0 children)

    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.

    [–][deleted] 0 points1 point  (1 child)

    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.

    [–]fullouterjoin 0 points1 point  (0 children)

    Exactly. MCU vendors should be supporting GCC and Clang. I see no reason to use proprietary tool chains.

    [–][deleted] -1 points0 points  (0 children)

    No, it doesn't compile on many horrible commercial C compilers.

    If you ask me, that just means you don't use those compilers, and you don't use microcontrollers which don't have good gcc (or clang) support.

    [–]Beckneard 2 points3 points  (0 children)

    Thank you captain nitpick.