What is Portability in C Programming?

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

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
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.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.