Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen should I use type abstraction in embedded systems
    primarykey
    data
    text
    <p>I've worked on a number of different embedded systems. They have all used <code>typedef</code>s (or <code>#defines</code>) for types such as <code>UINT32</code>.</p> <p>This is a good technique as it drives home the size of the type to the programmer and makes you more conscious of chances for overflow etc.</p> <p>But on some systems you know that the compiler and processor won't change for the life of the project.</p> <p>So what should influence your decision to create and enforce project-specific types?</p> <p>EDIT I think I managed to lose the gist of my question, and maybe it's really two.</p> <p>With embedded programming you may need types of specific size for interfaces and also to cope with restricted resources such as RAM. This can't be avoided, but you can choose to use the basic types from the compiler.</p> <p>For everything else the types have less importance.<br> You need to be careful not to cause overflow and may need to watch out for register and stack usage. Which may lead you to <code>UINT16</code>, <code>UCHAR</code>. Using types such as <code>UCHAR</code> can add compiler 'fluff' however. Because registers are typically larger, some compilers may add code to force the result into the type.<br> <PRE>i++;</PRE> can become <PRE>ADD REG,1 AND REG, 0xFF</PRE> which is unecessary.</p> <p>So I think my question should have been :-</p> <p>given the constraints of embedded software what is the best policy to set for a project which will have many people working on it - not all of whom will be of the same level of experience.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload