-
Notifications
You must be signed in to change notification settings - Fork 28
Repair problems ISO C signatures in <cmath>
#18
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
Comments
<cmath>
<cmath>
See also #17 |
Lines like this are actually incorrect since ISO C specifies return value of |
Hi @mikrocoder in your original report, there are some errof messages, but they are incomplete. At the moment, I can find three clear errors in lines 142, 143 and 144 here. Could you please find out what happens in your test case if you replace in the three lines mentioned above the type In my local test cases, I can reproduce some reported errors. All of the errors that I can find locally on my clean machine are eliminated when these three changes are made. In your original report, however, some other errors were mentioned. So I'd like your feedback if these three lines are the only problematic ones... |
Hello, unfortunately the 3 changes do not help. There are still declarations errors. By the way, the functions return an int only in C. In C++ a bool is returned. So bool would be correct in C++. The outputs of Microchip Studio are:
It is not output more precisely. What information is missing? Then I made the changes from bool to int still in the definitions. In the math.cc. Line 132, 137 and 142.
|
Hi @mikrocoder I tried with the compiler in standalone mode. I will try to "hook up" the 11.3 compiler and the STL to my running ATMEL Studio. I need to see if I can reproduce what you observe. |
Ahhh... OK. I see that we also need to patch The comprehensive fixes are running in my @mikrocoder it's a bit to ask, but would you be so kind as to be able to check the changes in my fork locally, before we do the next steps? |
Hi @mikrocoder the only relevant changes are located in the files |
Also, if you are following this thread, there have been numerous recent changes and improvements in handling 32/64-bit So even when we get done with this particular patch, we might do some reviewing. And I would not rule out the possibility that some tiny inconsistencies creep up as we progress forward. but... One issue at a time... |
Hello, I don't understand this as well as you do. Also, as I said, the return value in C++ is actually bool and not int. This should be clarified first before creating forks. What exactly should I check in your files? |
Hello, I just remembered that combie had pointed me to a modified math.h back then. This is from Zak Kemple. Translated with www.DeepL.com/Translator (free version) |
Hi @mikrocoder I'm happy you asked. Floating-point classification functions are confusing and there have been recent specification changes regarding them in C/C++. I'm not sure I understand each and every point, but the behavior of functions such as In addition to All of this leads to a somewhat confusing state of affairs for floating-point classification functionis. |
That patch, if I'm not mistaken, deals with mostly 32/64-bit The only problem in this entire thread is that some of the C-language functions/macros for floating-point classification, also The 11.3 compiler got stricter in these checks (evidently) and had small changes in I will probably be taking a much closer look into all this off-and-on. But the patch in my fork goes in the right direction. Ultimately, i do not agree with the presence of
|
Hello, now that I remembered what I had to change in my avr-gcc 11.2.0 back then to be able to use your avrStdLibCpp, namely the replacement of the math.h, I can safely claim that the original math.h of avr-libc by Jörg Wunsch, has remained unchanged between 11.2.0 and 11.3.0. It has certainly been like this for much longer. So I have to correct my first statement in this regard. I do not know why Zak Kemple has changes in it. But I ask myself why "you" did not have these error messages under Linux until now. The math.h is the same in all toolchains. No matter if Linux or Windows. I have compared. That would be another question besides that would interest me. I find it very nice that you take the time for it. 👍 Make you please no stress. 😃 Translated with www.DeepL.com/Translator (free version) |
With time and some work, I'd prefer to avoid changing the C-library header. The idea is that the C++ standar library is built on top of the existing C-headers. We shouldn't need to change headers to account for the C++ library. But if you're happy with it, OK. If you do check out my branch on the fork, it also works with both 11.2 as well as your build of 11.3.
Since the erroneous prototypes were in the STL port previously, I actually believe the compiler might have some stricter type-checking. Although I#m not entirely sure of this. |
Cool @mikrocoder I am glad you mentioned this. Oh this all makes sense now. The file you mention has, as it should, I really feel the urge to change our signatures (in the subroutines having C-linkage) to Cc: @chris-durand and @salkinium and @rleh |
There is really a lot right with that file. The signatures of things like |
I consider the exchange of the math.h only as a workaround. So that I could use your lib at all. If that compiles sometime without exchange would be very good. I am also interested that everything works as clean as possible. |
Oh definitely. Indeed. That's the goal. I believe that this PR at the moment strikes a good compromise. It works with the GCC 11.2 in the modm-io project and also works with the GCC 11.3 compiler that was provided for this PR earlier (it works locally for me). It's not a perfect state yet since there are a few discrepancies among the various im´plementations of |
Fixed in #20 |
Thank you very much. I will try it out soon. |
OK sounds good. If you happen to run into any inconsistencies remaining in the ISO C99 |
Hi, I have not forgotten you. :-) Found time today and may announce that your changes work. The old code compiles without errors. Just good. :-) Thanks a lot. Could it be that the new math.h is independent of the toolchain? |
Cool thanks for the feedback @mikrocoder.
In my opinion, the newer versions of |
The |
As discussed at length here, repair C signatures for functions like
isnanf
, etc. in<cmath>
.The text was updated successfully, but these errors were encountered: