Go Down

Topic: Serial print refresh time (Read 3266 times) previous topic - next topic

Arrch

#30
May 25, 2012, 11:28 pm Last Edit: May 25, 2012, 11:33 pm by Arrch Reason: 1
AWOL was right, my example was "rubbish".

They should have been char or byte rather than short. The concept still stands, just didn't have the right type for my example.

jraskell

Program size that is shown by Arduino is the size of the 'code' portion of the hex file.  Variable declaration data is stored in the same file, but as a separate 'section' of the file, and is not included in the reported program size.  The details of the hex file are a bit more complicated, but if you're feeling particularly ambitious, this page: http://www.nongnu.org/avr-libc/user-manual/mem_sections.html will give you an introduction to how it's laid out.  Just be forewarned, it may only make you more confused than you currently are though.  It isn't beginner material.

jtw11

Ahh - that would explain perfectly why the size isn't changing! I think I'll leave studying the link too hard for a while! :D

If an int (or a long or anything for that matter) is not defined as either signed, or unsigned - which does it default to? Unsigned I'd presume.

majenko

you'd presume wrong.

Some are signed, some are unsigned.

The basic types (int, char, short, etc) are usually signed by default.

Special types defined specifically by the Arduino code (byte, etc) may be unsigned.  You'd have to read the documentation to be sure.

That's why I never use the arduino specific ones and always use proper named ones.

Of course, there are the explicit ones - uint16, etc, where the "u" means unsigned, and the 16 means 16-bit, or 2 bytes.

jtw11

Okay, I've got what I need to know for this program at least. I can't see saving 1 or 2 bytes here or there are going to help with anything in the long run anyhow - but knowledge is king  ]:)

Thanks to all those who replied for their help!

Go Up