���������� �� C/C++
������������� �����

������������� const, volatilerestrict ������������� �������������� ���������� � ����������, ����� ������� ������� ��� �����.

const

������� ���� const �� ����� ���� �������� ���������� �� ����� � ����������. ����� ����, ������, ���������� � ������� ���������, ������� �������� ��� const, ����� �� ����� ���� �������������. ���������� ����� ��������� ���������� ����� ���� � ������, ��������������� ������ ��� ������ (read-only mem � ROM). ����������, ����������� ��� const, ������� ��� �������� ���� �� ����� �������������, ���� ����������� ���������� ���������-��������� �������.

const int a = 10;

���� �������-���� ������ �������������� ��. ���� const, �� ��� �� ����� �������� ������ ��������� ��� �������.

class my {
	void fl() const;
	const void sl();
}

volatile

����������� volatile �������� �����������, ��� �������� ���������� ����� ���� �������� ����������, ��������� � ��������� ������� �������. ��������, ����� ���������� ���������� ����� ���������� ��������� ��������� ������� ������� � ��������� ����� ������� ������� ��������� �����. � ���� ������ ���������� ���������� ���������� ��� ���������� �����-���� ����� ���������� ������������ � ���������. ��� ����� ������ ������, ��������� ����������� ������ ������������� ������������ ����������� ���������, ������ �� �������������, ��� ���������� ���������� �� ���������� ������ ����� ���������. ������ ���. volatile �� ��������� ���������� �������� �� ����������� ������������ ���� � ��� ������ �������, ����� ��� ������������� �� ���������.

restrict

� ������ �99 �������� ������������ ���� restrict, ������� ����������� ������ � ����������. ��������� � ��������� restrict �������� ���������� ������������ ���������, ����������� �������� ������ � �������, �� ������� �� ���������. ������ � ����� ������� � ������� ������� ��������� �������� ������ � ��� ������, ���� ������ ��������� ������� �� ������. ����� �������, ������ � ������� �������������� �����������, ����������� �� restrict-����������������� ���������. ���������, ������������ � ������� ������������� restrict, ������������, ������� �������, ��� ��������� ������� ��� ��� �������� �� ������, ���������� � ������� ������� malloc().

���� ��������� �������������� � ������� ��������� ����� restrict, ���������� ����� ���� ����� �������������� ������������ ���� ��������� �� ��� ���������, ��� restrict-��������� �������� ������������ ��������� ������� � �������. ��������, ���� ������� ������ ��� ���������-���������, ����������������� ��� restrict, ���������� ����� ������������, ��� ��� ��������� �������� � ��������� ��������(������� �� �������������). ���������� ��������� ������ ������������� ������������� restrict (������� ���� ������������), � ������ � ������� memcpy(). � ������ �89 � ����� C++ �� �������� ����� ��������� ���.

void *memcpy(void *strl, const void *str2, size_t ������);

� �������� ������� memcpy() ����������, ��� ���� �������, ���������� ����������� str1 � str2, �������������, �� ��������� ���� ������� �� ���������(), ����� �������, ������� memcpy() �������������� �������� ������ � ������������������ ���������.

� ������ �99 ������������ restrict ����� ������������ ��� ������ ��������� � ��������� ������� memcpy() � ���, ��� � ������ �89 � ����� C++ ���������� ���������� �������. ��� ��� �������� �������� ������� memcpy() � ������ �99.

void *memcpy(void * restrict str1, const void * restrict str2, size_t ������);

������������ ��������� � ������� ��������� ����� restrict, ���� �������� ���� ����������, ��� ��� ��������� �� ����������������� �������.






Нет комментариев.



Оставить комментарий:
Ваше Имя:
Email:
Антибот: *  
Ваш комментарий: