11 years, 11 months ago.

What C & C++ standard libraries are included?

What standard C & C++ libraries are included? Things like #include "stdlib.h", #include "stdio.h" and #include "time.h" compile OK, but the functions therein don't all work. For example, min(...) and randomize() don't compile at all, and time(...) returns const -1 (I think). sprintf(...) works fine. Global ::namespacing doesn't help.

[I haven't tried digging into the C++ stuff like templates and the STL, because there are things that Man Does Not Need To Know.]

Is there an official reference on all this?

2 Answers

11 years, 11 months ago.

Time should work fine, see: http://mbed.org/blog/entry/103/ (if you got an 11u24 it probably wont do much, since it has no RTC it cant work).

min also works fine for me (at least it compiles). Just got to add #include <algorithm>. IO stuff like cout should all work, but really you dont want to use it, that uses a terrible amount of RAM. Better stick to printfs and char arrays. Dunno about randomize, rand() does work with proper include, the C++ reference has no randomize() in it, so it might not be part of the official standard.

That was just testing if it compiles btw, not what it actually does.

Accepted Answer
Jim Davies
poster
11 years, 11 months ago.

Thanks. That's got the RTC working. I imagine it doesn't run until initialised with set_time(...). As for the rest, I suppose it's a matter of the difference between C (eg stdlib.h) and C++ (eg <algorithm>). Turns out that ANSI C includes srand(...) but not randomize() or min() and max(), unlike every C library I've ever used.