Go Down

Topic: uint_8 or such like (Read 6 times) previous topic - next topic

drjiohnsmith

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,



AWOL

#16
Jul 10, 2012, 07:48 pm Last Edit: Jul 11, 2012, 03:32 pm by AWOL Reason: 1
Quote
might save some typing for some one

It only saves typing if it is shorter than the Arduino equivalent, and spelled correctly.  ;)
"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.

drjiohnsmith

could it be longer than

unsigned long

?

WizenedEE

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: [Select]

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

drjiohnsmith

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.





westfw

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...

PaulS

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... 8)

cunctator


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.

drjiohnsmith

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.



Federico Vanzati

@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.
F

cunctator

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.  ;)


@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 :) ) 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!

drjiohnsmith

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 )



AWOL

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.
"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.

drjiohnsmith

AWOL

your the boss,

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





Constantin

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.

Go Up