AFAIK you can look in any "c++" book on what is expected as the standard. You may then need to use various #include <maths.h>
or similar. Here you have to look in the system directory. There is a whole hireachy of "Libraries"
in my window case
C:....your sketchbook location\libraries -- the user suppllied libraries; downloaded or written
C:\Programmer\arduino-1.0.5\libraries -- "arduino standard libraries" like Servo.h
C:\Programmer\arduino-1.0.5\hardware\arduino\cores\arduino -- "arduino" stuff that supports the core.
C:\Programmer\arduino-1.0.5\hardware\tools\avr\avr\include -- "c++" stuff. Not all is autoincluded
Yes - excpetions and limitations may apply - some standard C++ makes NO SENSE in the arduino enviroment (opening and closing files, writing stack dump to trace and such like). Also some object programming is memoy hungry and will exceed your RAM at some point (without warning or stack trace/dump) - the classical example this forum is using Strings.h "too much".
Msquare:
Yes - excpetions and limitations may apply - some standard C++ makes NO SENSE in the arduino enviroment (opening and closing files, writing stack dump to trace and such like). Also some object programming is memoy hungry and will exceed your RAM at some point (without warning or stack trace/dump) - the classical example this forum is using Strings.h "too much".
Perfect!
Thank you very much. I'll read something and learn more.
You really should not be looking at whether the Arduino (platform) can implement the more exotic functions of "C++", which would suggest you need to use a more capable platform to begin with.
It is more to the point to say that "C++" is a convenience for writing software to perform things for which an Arduino is appropriate. XD
Here is [u]AVR Libc[/u]. It might be what's "standard" for the Atmel AVR microcontroller. I don't see the Arduino-specific functions or the additional Arduino libraries (servo,etc.). So far, I've only used what's in the Arduino Language Reference.
I beleive [u]this[/u] is the complete Standard C++ Library. There are online references, but the only printed book I know of that has the actual complete ANSI/ISO C++ Standard Library is the ANSI/ISO C++ Language Standard itself. I seem to recall that it's about 700 pages. It's stricly a reference, and not that useful for learning to use the language orfor learning to program. And since C++ includes the C language, for completeness you also need the ANSI/ISO C Language Standard. Or, there are other books that cover the entire Standard C language.
I generally wouldn't worry about what's standard & non-standard C/C++ with a microcontroller. Microcontroller applications are very hardware-oriented, and it's unlikely that you'll be porting to a different platform/microcontroller, and if you do you'll have to re-write 90% of the code anyway.
If you are writing a computer application, you might want to separate your standard-portable C++ code from your Windows and/or OS-X functions. Then, if you make a Unix/Linux version, you'll know what modules are standard and don't have to be touched.
DVDdoug:
Here is [u]AVR Libc[/u]. It might be what's "standard" for the Atmel AVR microcontroller.
It's what's standard for anything compiled with AVR libc, which is generally any C/C++ you compile with the Arduino IDE, Atmel Studio, or yourself with gcc.
DVDdoug:
I don't see the Arduino-specific functions or the additional Arduino libraries (servo,etc.). So far, I've only used what's in the Arduino Language Reference.
Those aren't in AVR libc, they're Arduino-specific. AVR libc has nothing to do with Arduino, but Arduino uses AVR libc. It's one of those "square is a rectangle but rectangle is not a square" things.
Does anyone else think that this should be mentioned on the "Reference" page? All kinds of stuff is explained there, but - in part because the Arduino IDE lacks auto complete - many people are unware that string.h and stdlib.h are automatically included in every project. Or rather that they exist at all, when they are new to C/C++. Those two contain a lot of very basic and useful functions people seem to ask about a lot.
stdlib.h is mostly the same as the standard C version by the way, but it does include a few AVR specific functions.
this topic is quite inreresting, I have seen most super users that usualy recomend to use some avr libraryes that are special libraryes for the avr chips, and usefull for some kinds of proyects for exaple: <avr/power.h> or <avr/sleep.h> also <avr/eeprom.h> or <avr/interrupt.h>
DVDdoug thanks for the avrlibrary's link, I'm not the guy that started the treath but thanks
Serenifly the auto complete is a great idea, I reed about a plugin for sublimetext2
What specifically should be mentioned? (Just curious.) A link to the AVR libc docs?
Keep in mind that the Arduino project really tries to insulate the user from most of the "C-ness" of programming. It's not your typical IDE. If it were, you would have to do quite a bit more of the housekeeping that ordinary C developers are used to. The nice thing is, if you've already learned a traditional development environment, you can take your code and the Arduino libraries to that IDE where you might be more comfortable.
Perhaps like you, I find the "black box" aspect of it a little unnerving since I know my way around C (for the most part) and would rather be aware of what the IDE is doing on my behalf. That documentation does exist for those who know to look for it, although it's not front and center. I think that's because those who aren't inclined to seek out that info probably wouldn't understand much of it anyway. Therefore it's not in the simple reference tables to avoid implying that it's necessary to understand the underlying C libraries and toolchain to use the product. That kind of detail would overwhelm a fair segment of users here -- which is by design. It should be simple enough to use that you don't have to know that stuff.
This is all my own opinion of how things are run, so I could be wrong here and there, but the overall ethos seems to be "make it simple", but without encouraging ignorance. If you want to know more, great. If you don't, that's fine too.
Maybe something like: "for more available libraries and functions see...:" and then a link to the AVR doc.
Though to be honest that one isn't easily readable. Personally, I really like http://www.cplusplus.com/reference/clibrary/ but that would be confusing to link to, since of course not everything there is available on the AVR. But the functions are explained very nicely with examples.
math.h could be mentioned under "Math", though that one is probably used less often.
Sure, for beginners some of that stuff is very intimidating. C string handling for example is entirely different than what someone is used to when they come from things like Java or C#. And it's easy to make some fatal errors. I can fully understand that some people don't understand it or are put off by the strangeness of it.
You certainly don't need everything, but a few functions can become necessary very quickly even for relatively simple applications. I've seen several people searching for ways to compare strings (some stumbling by trying to use ==) or convert input from Serial to integers (and for reliable, generalized Serial input you can't really rely on parseInt()). Of course they won't master the entire library, but if someone knows that atoi() or strtol() exist, maybe they can get further on their own. Another often used function that's very useful is sprintf() for formatting sensor output for printing. Or dtostrf() to format a float value to a certain precision. Both tasks that people quickly encounter when they want to write something to an LCD or to the SerialMonitor for example. And once you know how to use them, less awkward and far more powerful than the the limited formatting options provided by println() (where you can't concatenate variables). Simply writing a string to a char array is also something I've seen several people try and fail to do - and easily solved by either sprintf() or strcpy().
I don't think simply mentioning that these functions exist pushes people to use them. They don't need them for most tasks. Justfor some. The Arduino abstraction is nice in many ways, but in a few areas it's also very limited.The Arduino IDE stuff is still front and center. But I get the impression that some people think that's all there is.
You make some good points. IMO, once you have to get involved with string handling, you're into "real C". There's not enough abstraction to make all of that as easy as other languages. It's a rather sharp learning curve from there.
It would be nice to see a little more information regarding AVR libc. Not reinventing the wheel, but like you were saying, at least a link, and more prominent articles on what it is and how it fits in. When I first started, it took a while to find out about those docs at all. It was also quite confusing trying to determine what was Arduino and what was libc. Now it's obvious, so I've forgotten about all the trouble I went through to learn it.