New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly use C11 dialect #1

merged 2 commits into from Jul 4, 2016


None yet
2 participants
Copy link

insom commented Jul 2, 2016


Thanks for creating this project. On Ubuntu Xenial with the arm-none-eabi-gcc package, the supplied makefile gives these errors:

src/main.c: In function 'main':
src/main.c:21:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
         for (uint16_t i = 0; i != 0xffff; i++) { }
src/main.c:21:9: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
src/main.c:24:23: error: redefinition of 'i'
         for (uint16_t i = 0; i != 0xffff; i++) { }

Adding -std=c11 as the error suggests returns everything to working order. Just thought this might save some future person a bad 'out of box' experience.

@insom insom force-pushed the insom:c11 branch from bb8cd06 to ac1557e Jul 2, 2016


This comment has been minimized.

Copy link

kcuzner commented Jul 2, 2016

It might be better to use C99, actually. C11 is so new that I don't think its common enough in older versions of GCC to be used yet. Not everyone uses the most up to date GCC. I read somewhere that not even all of C99 has been implemented in open source compilers.

Do you want to change it to C99 or did you have a specific reason for C11 over C99?


This comment has been minimized.

Copy link
Contributor Author

insom commented Jul 4, 2016

@kcuzner GOOD point. I've updated this to C99 - that's sufficient to allow declaring variables inside for loops.

@kcuzner kcuzner merged commit 5d54dc7 into kcuzner:master Jul 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment