Why do I need a standard code?

Often I see people arguing that the code is not standard. what do they really mean?

for example, if I said:

itoa () to convert an integer to a character, and they will ignore it, implying that "the code is non-standard!".

+3
source share
9 answers

Some implementations of the C ++ standard allow certain things that are not allowed.

If you use these functions, you can say that your code is not up to standard.

Example:

int x = 5;
char arr[x];

The above code is not allowed in the C ++ 03 standard, but is allowed in C99. At the same time, some compilers claiming to implement C ++ 03 can use this code in a C ++ program.

+10
source

, . . , , . __uuidof (T) MSVC. , , , .

+6

, " ANSI C/++". , , .

+3

"" .

, , , . , ( -, ). itoa() - ​​ , , , .

, , - / , , . , , Stackoverflow, , , , , , . itoa) snprintf() , itoa(), .

, undefined, , , - , , . ; undefined , , , , , "" , . .

, ( ) , , , , . , , .

+2

, "" ++, - , , . , comp.lang.++, , , , ++. ..

, , ++ . -, , , . , , , , .

+1

, C ++. - , , "" ( ); :

, . , gcc MSVC, , ; itoa - .

, , . , Windows Linux, , , , ( , ).

+1

C ++ ISO. , C ++, , , .

, , , .

" " , (, itoa) , , . (, Microsoft ++, volatile , , )

, . , . itoa, , , , .

, . , , , , .

+1

, itoa() Posix (unix), ISO _itoa(), , jalf, .

0

One strange function that I saw in the compiler that comes with UBuntuis that you can dereference an uninitialized pointer. And it just happened using memory in my program space.

I don’t know which version of UBuntu, but my professor and I were very puzzled to see this. And I remember that in this case the result is 1.

-1
source

Source: https://habr.com/ru/post/1784440/


All Articles