Offline
Full Member
Karma: 0
Posts: 120
|
 |
« on: July 08, 2012, 12:57:25 pm » |
I have seen in some code snipets, the use of short hand terms , something like
uint_8t in place of unsigned int,
Do we have a list of these some where, and where they are picked up from ?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #1 on: July 08, 2012, 01:50:51 pm » |
uint_8t in place of unsigned int, No, that would normally be in place of an unsigned char.
|
|
|
|
« Last Edit: July 08, 2012, 02:01:59 pm by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 120
|
 |
« Reply #2 on: July 08, 2012, 02:01:10 pm » |
Ok,
but where is the definition of what we have pre defined, I could define my own set of abbreviations, in a .h file.
but as we have them somewhere, where are the definitions please ?
how about putting them into the reference area !
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #3 on: July 08, 2012, 02:38:41 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 120
|
 |
« Reply #4 on: July 08, 2012, 03:32:52 pm » |
thank you
easy when you know where
how do we get this info put in the arduino reference so we can all use it ?
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #5 on: July 09, 2012, 01:53:07 am » |
Personally, I think the reference pages should be kept for Arduino specific information, which this isn't. easy when you know where I didn't know where, so I typed 'uint_8t' into Google. Anyone could do that.
|
|
|
|
|
Logged
|
|
|
|
|
SF Bay Area (USA)
Offline
Faraday Member
Karma: 78
Posts: 5455
Strongly opinionated, but not official!
|
 |
« Reply #6 on: July 09, 2012, 02:32:21 am » |
It's a standard C programming thing that goes WAY beyond just Arduino and AVR: http://en.wikipedia.org/wiki/C_data_types#Fixed_width_integer_types(It's scary that Arduino and avr-libc pages show up first in google results!)
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 120
|
 |
« Reply #7 on: July 09, 2012, 02:32:48 am » |
so your suggesting:
that we don't document unless its arduino specific, what about the style guide ?
And as for use google, well, thats like saying to my kids when they ask me how to spell a word, look it up in the dictionary. I knew from my past that arduino would have a set of abbreviations for unsigned long etc, and I wondered what they were, why not have it documented in arduino world.
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #8 on: July 09, 2012, 04:49:02 am » |
well, thats like saying to my kids when they ask me how to spell a word, look it up in the dictionary. What's wrong with that? I was often told that. It increased my vocabulary quite significantly, as I never just looked at the word I wanted to spell, but others around it too. I find it often works the same with Google. I knew from my past that arduino would have a set of abbreviations for unsigned long etc, and I wondered what they were, why not have it documented in arduino world. It's not 'Arduino' that has a set of abbreviations (although that's not really the right word), it's C. I think it's perfectly reasonable to not have all of C/C++ documented on the Arduino site, when that documentation is so easy to find elsewhere.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 120
|
 |
« Reply #9 on: July 09, 2012, 09:10:22 am » |
dis agree on a fundamental basis.
Arduino is aimed at artists etc, not programmers. or so the aims say on the front page.
hence we should make learning as easy as possible , that I guess is why the guide says dont use pointers.
things like uint_8, they are a short cut , but I have seen many different ways of writting them over the decades, so having and documenting a standard that we'd like Arduino code to follow, to me is a good thing.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #10 on: July 09, 2012, 09:29:12 am » |
hence we should make learning as easy as possible Sometimes, that means not telling someone something, or simplifying. Remember learning the solar system model of the atom at school, and then, a couple of years later being told it really isn't like that at all? things like uint_8, they are a short cut No, they're not - shortcuts are short, and "uint8_t" is longer than "byte". 
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #11 on: July 09, 2012, 09:40:07 am » |
dis agree on a fundamental basis. Nothing wrong with that. We are both entitled to opinions. I do think that a link to http://cplusplus.com/, or some other appropriate site, should be prominently displayed on the reference page.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 120
|
 |
« Reply #12 on: July 09, 2012, 10:25:43 am » |
re byte , interesting you have to include arduino.h to get byte, or include a library that itself points to said.
re c++, interesting that you point to C++, Arduino examples are all c based,
OK, YES I know C is a subset of C++. but C++ is a different mind set to C is it not ?
( Hay I was around programming when B was the language, and this C thing was an idea.. )
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #13 on: July 09, 2012, 11:03:58 am » |
interesting that you point to C++, Arduino examples are all c based, I only suggested http://cplusplus.com/because I knew the address. That's why I added 'or some other appropriate site'. Perhaps http://www.cprogramming.com/ would be better.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 42
|
 |
« Reply #14 on: July 10, 2012, 09:42:20 am » |
Well, I generally avoid byte and word since I don't know what size or sign they are. OTOH uint8_t does what it says on the tin - it's an unsigned 8-bit value. Same with uint16_t and uint32_t - I'm not sure any further documentation is needed.
Will
|
|
|
|
|
Logged
|
|
|
|
|
|