parseInt() returns an int?

That's the way I read the doc, http://arduino.cc/en/Serial/ParseInt

But if I'm reading the code correctly, it actually returns a long.

Yes, it returns a long. But then what is a long if not a kind of int? Int itself isn't a type - on an 8 bit system it's a synonym for "short int", and "long" is a synonym for "long int". So although it may read as it's wrong, from a certain PoV it's right ;) Integer as a concept has no size - it's the set of all whole numbers.

But yes, it does say it returns "int", which equates to "short int", whereas actually it returns "long int", so yes, it's wrong on the web page.

What is the difference then in the, long parseInt() and the, float parseFloat() functions?

LarryD: What is the difference then in the, long parseInt() and the, float parseFloat() functions?

The parseInt parses integers, the parseFloat parses floating point numbers.

majenko: But yes, it does say it returns "int", which equates to "short int", whereas actually it returns "long int", so yes, it's wrong on the web page.

Yes, I have to read it in the context of the Arduino environment, so an int is a 16-bit type. Contrast the millis() doc. millis() returns an unsigned long and it says so, it doesn't just say int because an unsigned long is a kind of integer.

[quote author=Jack Christensen link=topic=181799.msg1347388#msg1347388 date=1376002165] Yes, I have to read it in the context of the Arduino environment [/quote]

The Arduino online reference is abysmal and even where it provides information about the actual method/function signature I wouldn't put a great deal of faith in it. In many places, it doesn't actually tell you what the signature is and also doesn't give you any hint as to where you'd find that defined in the source code. Other than a bit of general hand-waving about the purpose of the API it's next to useless. Which is odd, given how many ways there are to generate API documentation from the source code these days.

In My Not so Humble Opinion the one thing that has held Arduino from going completely viral is lack of good accurate and available documentation... I Hate using the reference because I usually only get half an answer... The wrong half. Actually I get more from Cplusplus.com.

Doc

PeterH: The Arduino online reference is abysmal and even where it provides information about the actual method/function signature I wouldn't put a great deal of faith in it. In many places, it doesn't actually tell you what the signature is and also doesn't give you any hint as to where you'd find that defined in the source code. Other than a bit of general hand-waving about the purpose of the API it's next to useless. Which is odd, given how many ways there are to generate API documentation from the source code these days.

Lack of accountability, that's the problem. Who do you blame? I don't know, and neither does anyone else, I suspect.

Programmers who enjoy writing documentation are as scarce as hen's teeth. I had my own software company for almost 20 years and could not get programmers to document their work. We then adopted a coding style, much like what PeterH is suggesting, that was rigorously enforced. We had code walk-throughs every Friday and any programmer's code who didn't conform to the standard had to buy pizza for lunch for everyone. If everyone's code passed muster, they got off Friday an hour early. (My shop only had 10 people.) You'd be amazed how 9 other people yelling at you changes your coding habits. Best of all, the owner's not the bad guy. Nick's point hits the nail on the head...documentation for most is no fun hence they don't do it, but with the Arduino, who do you point the finger at? Jack: I've read a number of your posts and your grasp of assembler has proven useful to me. Carry on the good fight. Perhaps this post will cause someone (?) to edit the docs on parseInt().

Thanks, @econjack. I did quite a bit of assembler in previous lives but I'm barely scratching the surface with AVR assembler. But it's one of those things, once you get it, a lot carries over from one machine to another. Sometimes I actually like doing documentation, it gives the feeling of a project being truly complete. Then there are other times, which is why I have a couple projects that have been complete for months except the doc :blush: :D