#define _FARQ的解释
看到这样一段代码:
template<class_Ty> inline
_Ty _FARQ *_Allocate(_SIZT _Count, _Ty _FARQ *)
{
//check for integer overflow
if(_Count <= 0)
_Count = 0;
else if(((_SIZE)(-1)/_Count) < sizeof(_Ty))
_THROW_NCEE(std::bad_alloc, NULL);
//allocate storage for _Count elements of type _Ty
return((_Ty _FARQ *)::operator new(_Count * sizeof(_Ty)));
}
对于其中的 _FARQ很不理解,转到定义处,看见:
#ifndef _FARQ /* specify standard memory model */ #define _FARQ #define _PDFT ptrdiff_t #define _SIZT size_t #endif /* _FARQ */
竟然将_FARQ定义成了空,什么也没有。
在网上找到的解释:
Back in the days of 16-bit computing, pointers were 16-bit. Way small, so (and don't ask me for the specific mechanics as I don't know) a "full pointer" would be composed by two pointers: A near pointer and a far pointer. I think they had other names; the word "offset" comes to mind.
Anyway, back in 16-bit computing, those things like _FARQ had meaning. Now that everything is 32 bits and only one pointer is needed, FAR and NEAR stuff are just there for backwards compatibility with older code, but the original definition was changed to nothing.
浙公网安备 33010602011771号