What is meant when a piece of code is considered portable?

In many documents, I saw that a piece of code is wrapped .

Can someone explain to me what it means to call a piece of code portable?

+5
source share
3 answers

Portable code is code that is not closely related to one particular platform or that is as weakly connected with the platform’s APIs as possible. It is “carried over” by the fact that the amount of work required to move it from one platform to another is low.

Portable code is desirable when you intend to write code intended for use by a large audience on a wide variety of platforms.

, , . - , , backticks exec , , , - .

, - API .

, "", API. , , , , .

+5

- , , .

(, , , , /, ).

, ( ) #ifdef, .

C/++. .

+2

?

, ; , , , ..

, , .

?

The reason this is so important is that non-portable code can cause many maintenance problems - managing multiple versions, low readability / understandability of the code, to name a few.

+2
source

All Articles