Electronic Design

C Standards: More Or Less

C and C++ standards keep compiler vendors in line, while system and application developers appreciate the portability aspects. But embedded developers de-mand more and sometimes less than what the standards specify.

These days, DSP developers use C and C++ more often than not, and DSP architectures tend to support C and C++. There isn't much conflict for integer or floating-point DSP support, but fixed point is another matter. Here, DSP-C extensions come into play. A fixed-point data type is added on top of other memory- and device-related features.

Many companies have tried to address the fixed-point problem with varying degrees of success. Motorola utilizes C macros and function definitions, which offers the advantage of working with most C compilers. As a result, the same technique can be used with Motorola's compilers, or third-party compilers.

Of the various extensions, DSP-C looks to be the best bet as a new ISO standard (see "DSP-C 'Fix-Points' C," p. 71). Check out Technical Report No. 18037. MISRA C (The Motor Industry Software Reliability Association) and Embedded C++ (EC++) are subsets of C and C++, respectively. ISO standardization may not be right around the corner, but both are de facto standards.

Many programmers despise subsets, but MISRA C and EC++ are really needed. MISRA C is designed to improve reliability and safety. That's a tough job for a language where shooting one's own foot is a common pastime. EC++ is designed to reduce the execution footprint for C++ applications. C++ features added to C (e.g., templates and exception handling) are invaluable in most situations. Still, they add overhead. EC++ attempts to streamline C++.

C and C++ compilers, especially those targeted for embedded systems, support one or more of these standards. Although it's nice to have options, which one do you choose? More or less?

TAGS: Digital ICs
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish