Pages: 1 [2] 3   Go Down
Author Topic: uint_8 or such like  (Read 4914 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 3
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you know the abbreviations exist, then that is the documentation

but we don't document anywhere on the arduino site that such abbreviations are around, and are in fact IMHO  normal coding standard,

do we want to doc here what we have

unit_8t => byte, or is that char equivalent
unit_16t => Unsigned int
int_8t  => byte , or is that char ?
int_16t =>  int

might save some typing for some one , and some more understanding,


Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
might save some typing for some one
It only saves typing if it is shorter than the Arduino equivalent, and spelled correctly.  smiley-wink
« Last Edit: July 11, 2012, 08:32:25 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 3
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

could it be longer than

unsigned long

?
Logged

Offline Offline
Edison Member
*
Karma: 17
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino examples are all c based,

87 out of 125 of the IDE's examples include the class Serial. Every one of the IDE's built-in libraries is a class. All of the external libraries I have downloaded are a class.

How are they based on c if they use classes -- the most important C++ feature?

source:
Code:
~/arduino-unstable/examples$ grep -rl 'Serial\.' * | wc -l
87
~/arduino-unstable/examples$ find -iname *.ino | wc -l
125
Logged

Offline Offline
Sr. Member
****
Karma: 3
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok

lets call this quits shall we,

I think that we should support new coders by including in the start documents that they can use standard abbreviations such as we have been discussing.

thanks for your time, its been an insight into the Arduino world.




Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6381
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
we should support new coders ... standard abbreviations
My thought is that the Arduino team specifically rejected the idea of documenting all the standard C/C++ features, statements, and types, because in the 40-odd years of their existence, the standard C types (and other features of the language) have done little but confuse new programmers, and the added fixed-size types didn't do much other than make the names more explicit for experts and more incomprehensible for beginners.  (I can see the questions now: "I understand the "int" part, I think.  but what does "32_t" do?  is that some sort of subtraction? (really.  Within the last month there was a discussion somewhere where the OP didn't grasp which parts of some typedef-like expression were part of the name, and which were relevant to the expression.  Those people are Arduino's target audience.)

Now; some sort of guide that is in-between the Arduino documentation and the ANSI C99 specification or the latest "how to" book for CS  majors would probably be a good thing...
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 553
Posts: 46294
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Now; some sort of guide that is in-between the Arduino documentation and the ANSI C99 specification or the latest "how to" book for CS  majors would probably be a good thing...
But, everyone would argue over how close to either end of the spectrum to target... smiley-cool
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Arduino is made for competent artists.
It's a piece of programmable hardware, not a toy, when you write down a sketch ure writing it in C/C++ not in hendecasyllables.
It is a "prototyping board", built by technicians for technicians with simplicity in mind and ease of use for technicians, not for "what a uint8_t is?" people.
RTFM, STFW.
Logged

Offline Offline
Sr. Member
****
Karma: 3
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

just to clarify.

I never asked what is a uint_8

what I asked is where the definitiions that I knew must exist were documented for the arduino project.


I ask for two reasons.
  a) to help improve the documentation so others might learn the sort of short cuts that us programers expect.
         as it says at the top , in blue, on the front page http://arduino.cc/
 
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

  and b)
    each and every community I work in, has their own 'standard'. Some use uint8, some uint_8, some Uint8t
       etc. there are many different 'standards'. I wanted to know what the arduino community , working together had decided upon, and where that was documented so I would follow the community.


Logged

Global Moderator
Milano, Italy
Offline Offline
Edison Member
*****
Karma: 15
Posts: 1163
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@cunctator: Your approach is harmful, we are all here to learn. Is prohibited to attack verbally other users.

Please change your attitude to beginners, if you are an expert, spread your knowledge if you want.
Logged

F

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, i'll retry in a lesser trolly way so...

First of all uint8_t isn't a shortcut, it's a macro ( preprocessor definition ) or compiler type definition, the C preprocessor will substitute every occurrence of that word in the code with something else.
Now, uint8_t means "Unsigned INTeger 8 bit long data Type" and then, its equivalent in standard C99 for any 8bit or bigger address length processor is unsigned char, a bitfields that can contain integral values between 0x0 and 0xFF ( 0 - 255 ).
Other useful macros like this are uint16_t, uint32_t, uint64_t, uint128_t, int8_t, int16_t, int32_t, int64_t, int128_t, each used to declare a specific data type, in size and signess, they are provided almost just for cross compatibility ( for instance on arduino uint16_t is unsigned int , while on usual x86 desktop processor is unsigned short due to the nature of the Atmel cpu it has on board ).

The use of uint_8 inside the Arduino core files is due to the strict relation between the Atmel GCC (Gnu Compiler Collection) and the *NIX based GCC, wich storically has been used with this kind of core data types ( usually declared in /usr/include/stdint.h ), almost every UNIX or GNU/Linux system cores ( any kind of system that strictly follows the POSIX specifications ) have been written using those kind of keyword, while Windows systems are historically written with similar BYTE, WORD, DWORD and QWORD data types.

Because Atmel choose to use a semi-standard gcc *NIX based tool-chain they kept as a legacy the use of the "stdint.h" file ( look in [Your Arduino folder]/hardware/tools/avr/avr/include/stdint.h, at line 79 there is our friend uint8_t ), but as you see this has nothing to do with Arduino, but with its third-party toolchain.

This is why ( i think ) there should not be a topic about it on the Arduino documentation, at least i could understand something about their specific byte ( defined in [Your Arduino folder]/hardware/arduino/cores/arduino/Arduino.h line 94 ) but it is so much self explanatory that would be somewhat redundant.

I hope my answer will be more usefull this time and will give u more details to solve you question.  smiley-wink

@cunctator: Your approach is harmful, we are all here to learn. Is prohibited to attack verbally other users.

Please change your attitude to beginners, if you are an expert, spread your knowledge if you want.

My attempt was not to attack anyone, just to say that this product is an advanced piece of hardware and software, not an entry point for beginner coders, for instance the 2K available memory management is something that even a skilled programmer feels hard to handle in complex projects, the way timers and interrupts are fired needs some background for beeing used in a safe and productive way, serial communication needs precise optimization, and that's asynchronous!
(you?) Arduino guys made a great work making it easy to use, but still there is GCC, and AR behind the corner and much more that needs some kind of know-how, background and competence.
Nothin against beginners ( we were all noobs smiley ) but a learning curve exsists because we cannot just jump to the top, and even if Arduino is not (yet) the top, it lies high!
Logged

Offline Offline
Sr. Member
****
Karma: 3
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you,

can I make a suggestion,

people learning are going to be using the reference pages.

http://arduino.cc/en/Reference/UnsignedInt

so why don't we add to the pages that describe each of the types, that you can, and are encouraged to abbreviate to uint16_t, uint32_t, uint64_t, uint128_t, int8_t, int16_t, int32_t, int64_t, int128_t

( obviously the right abbreviation / macro for each type )


Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so why don't we add to the pages that describe each of the types, that you can, and are encouraged to abbreviate to uint16_t, uint32_t, uint64_t, uint128_t, int8_t, int16_t, int32_t, int64_t, int128_t

Unless portability is a necessity, I'd say you're not encouraged to use any of the types listed.
I'd rather not see them listed at all on the Arduino reference pages.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 3
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

AWOL

your the boss,

if you dont want unit8_t etc in the reference, then that the end of the conversation,




Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

FWIW, the largest u/int that the Arduino can handle out of the box is a 64-byte one. And if you want to print out int64's be prepared to write  your own print function for same as Serial.print won't handle them.

I wish there were a way to handle int128's on the Atmel 328P but I guess if I ever want to implement a quadratic solution for a 16-bit ADC calibration routine then I'll have to graduate the board design to a 16 or 32-bit microprocessor. In the meantime, I just confirm that the results are good using on-board reference resistors. Oh well.
Logged

Pages: 1 [2] 3   Go Up
Jump to: