What is the difference between a free-standing and a hosted environment?
Not all C programmers write database management systems and word processors. Some write code for embedded systems, such as anti-lock braking systems and intelligent toasters. Embedded systems don’t necessarily have any sort of file system, or much of an operating system at all. The ANSI/ISO standard calls these “free-standing” systems, and it doesn’t require them to provide anything except the language itself. The alternative is a program running on a PC or a mainframe or something in-between; that’s a “hosted”
environment.
environment.
Even people developing for free-standing environments should pay attention to the standard library. For one thing, if a free-standing environment provides some functionality (such as a square root function), it’s likely to provide it in a way that’s compatible with the standard. (Reinventing the square root is like reinventing the square wheel; what’s the point?) Beyond that, embedded programs are often tested on a PC before they’re downloaded to a toaster (or whatever). Using the standard functions will increase the amount of code that can be identical in both the test and the real environments.
Cross Reference:
XII.1: Why should I use standard library functions instead of writing my own?
Chapter XV: Portability
No comments:
Post a Comment