(int _far*)在Turboc2.0中为何出错?
整个程序如下:
#include "stdio.h"
#include "malloc.h"
#include "stdlib.h"
void main()
{
int *bufint;
char *bufchar;
printf("Allocate two 512 element buffers.\n");
if((bufint=(int*)calloc(512,sizeof(int)))==NULL)
exit(1);
printf("Allocated %d bytes at %Fp.\n",_msize(bufint),(int _far*)bufint);
if((bufchar=(char*)calloc(512,sizeof(char)))==NULL)
exit(1);
if((bufchar=(char*)_expand(bufchar,1024))==NULL)
printf("Can't expand.");
else
printf("Reallocated block to %d bytes at %Fp.\n",_msize(bufint),(int _far *)bufint);
free(bufint);
free(bufchar);
exit(0);
}
这两句话编译器说有问题,不知道为什么?
printf("Allocated %d bytes at %Fp.\n",_msize(bufint),(int _far*)bufint);
printf("Reallocated block to %d bytes at %Fp.\n",_msize(bufint),(int _far *)bufint);
问题点数:0、回复次数:5Top
1 楼Casbalanca()回复于 2002-12-05 09:03:01 得分 0
up
Top
2 楼flyycyu(fly)回复于 2002-12-05 09:10:44 得分 0
你的指针的先建成远程的Top
3 楼Casbalanca()回复于 2002-12-16 17:11:22 得分 0
upTop
4 楼Casbalanca()回复于 2002-12-31 15:28:46 得分 0
(int _far*)bufint是不是把bufint转换为远程指针啊?Top
5 楼unrealimage(幻影的咖啡)回复于 2002-12-31 23:04:31 得分 0
这个是编制混合程序长用的
在远掉用的范围为64k而一般的段挑用为2k
看看微机原理的一章解释计算机的内存分配
再看masm的指针范围和有效范围
之后看c与汇编混合的模式
就明白了Top




