-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Should not compile with -fpermissive? #268
Comments
A beginner, posting on the Arduino forums, came up against this too, with the following code:-
It compiles fine with IDE V1.6.11, but in earler versions of the IDE, it quite correctly produced the following error:-
I think it's a step backwards, just for the sake of making a few bad libraries compile. |
AGREE! |
This compiler flag was introduced in commit ba0c41b, in order to not break the build of some old libraries. I am not convinced it is a good thing to not let the library authors know about the problems with their bad code. Anyway, here is another real-world example of a user being confused by this behavior:
|
This prevents mjs from compiling |
I think it may be an option to add a configuration to the preferences to set What's the intended roadmap to fix this issue? |
The only other official platform using |
FWIW, Teensy uses -fpermissive, because users have found (poorly written) libraries and examples which work on AVR boards. |
That sounds like a good idea to make sure new code becomes better, but old code can still be compiled if needed. I've thought about such a flag before, in a broader context of deprecating things. I can imagine a flag that says "Increased compatibility", which could control |
Today, I ran into some problem, which turned out to be caused by the compiler happily passing an
int
to a function that expected a pointer. Closer investigation showed that a warning was issued, where I would have expected an error. This seems to because of the-fpermissive
flag, which gets passed by the avr core by default. According to the gcc manpage:I'm not sure what changes this makes exactly and if we need it at all. If the other changes are similar to this one, I think it should be disabled at some point (but it will probably break existing code that isn't quite correct, but now happens to work)...
For reference, here's a simplified version of my problem:
(the real problem was more subtle, involving a struct with a conversion operator to int, which got silently converted to a pointer containing rubbish when I forgot the
&
operator when trying to pass the struct's address to a function).The text was updated successfully, but these errors were encountered: