LINUX.ORG.RU

История изменений

Исправление MOPKOBKA, (текущая версия) :

а чего вдруг? ты можешь сравнивать что угодно с чем угодно. если ты сам понимаешь, куда указывают твои указатели.

Потому что так говорит стандарт, я его процитировал считай. Можно и реальное обоснование найти, архитектуры с сегментами например, или архитектуры с аппаратными умными указателями, которые вообще не допустят подобного сравнения.

When two pointers are compared, the result depends on the relative locations in the address space of the objects pointed to. If two pointers to object types both point to the same object, or both point one past the last element of the same array object, they compare equal. If the objects pointed to are members of the same aggregate object,pointers to structure members declared later compare greater than pointers to members declared earlier in the structure, and pointers to array elements with larger subscript values compare greater than pointers to elements of the same array with lower subscript values. All pointers to members of the same union object compare equal. If the expression P points to an element of an array object and the expression Q points to the last element of the same array object, the pointer expression Q+1 compares greater than P. In all other cases, the behavior is undefined.

Исправление MOPKOBKA, :

а чего вдруг? ты можешь сравнивать что угодно с чем угодно. если ты сам понимаешь, куда указывают твои указатели.

Потому что так говорит стандарт, я его процитировал считай. Можно и реальное обоснование найти, архитектуры с сегментами например, или архитектуры с аппаратными умными указателями, которые вообще не допустят подобного сравнения.

When two pointers are compared, the result depends on the relative locations in the address space of the objects pointed to. If two pointers to object types both point to the same object, or both point one past the last element of the same array object, they compare equal. If the objects pointed to are members of the same aggregate object,pointers to structure members declared later compare greater than pointers to members declared earlier in the structure, and pointers to array elements with larger subscript values compare greater than pointers to elements of the same array with lower subscript values. All pointers to members of the same union object compare equal. If the expression P points to an element of an array object and the expression Q points to the last element of the same array object, the pointer expression Q+1 compares greater than P. In all other cases, the behavior is undefined.

Исправление MOPKOBKA, :

а чего вдруг? ты можешь сравнивать что угодно с чем угодно. если ты сам понимаешь, куда указывают твои указатели.

Потому что так говорит стандарт, я его процитировал считай. Можно и реальное обоснование найти, архитектуры с сегментами например, или архитектуры с аппаратными умными указателями, которые вообще не допустят подобного сравнения.

When two pointers are compared, the result depends on the relative locations in the address space of the objects pointed to. If two pointers to object types both point to the same object, or both point one past the last element of the same array object, they compare equal. If the objects pointed to are members of the same aggregate object,pointers to structure members declared later compare greater than pointers to members declared earlier in the structure, and pointers to array elements with larger subscript values compare greater than pointers to elements of the same array with lower subscript values. All pointers to members of the same union object compare equal. If the expression P points to an element of an array object and the expression Q points to the last element of the same array object, the pointer expression Q+1 compares greater than P. In all other cases, the behavior is undefined.

Исходная версия MOPKOBKA, :

а чего вдруг? ты можешь сравнивать что угодно с чем угодно. если ты сам понимаешь, куда указывают твои указатели.

Потому что так говорит стандарт, я его процитировал считай. Можно и реальное обоснование найти, архитектуры с сегментами например, или архитектуры с аппаратными умными указателями, которые вообще не допустят подобного сравнения.