What is Concept of Portability in Context with C Programs

«
»
Question: What is Concept of Portability in Context with C Programs

Answer: Linux is a portable operating system which supports wide range of computer architectures. Portability refers to how easily- if at all- code can move from one system architecture to another. We know that Linux is a portable because it has already been ported to various implementations. To view which implementations Linux has ported to, type in the following command

vim /usr/src/kernels/2.6.43.8-1.fc15.x86_64/arch/

and output views as

advertisement
alpha/     c6x/     hexagon/ m68k/       openrisc/ score/   um/
arm/       cris/    ia64/    microblaze/ parisc/   sh/      unicore32/
avr32/     frv/     Kconfig  mips/       powerpc/  sparc/   x86/
blackfin/  h8300/   m32r/    mn10300/    s390/     tile/    xtensa/

Portability of a C program across the wide range of implementations requires to use standard library which has mandated set of functions and they will have the required interface and then work in the the prescribed manner.

advertisement

ANSI C implementations include library in specification. Further, ANSI implementations aren’t prohibited from adding additional functions in the library. But if you are concerned with writing portable code use standard functions and avoid any non-standard functions.

Sanfoundry Global Education & Learning Series – 1000 C Tutorials.

If you wish to look at all C Tutorials, go to C Tutorials.

advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn