- 论坛徽章:
- 0
|
本帖最后由 seyjs 于 2012-04-07 18:06 编辑
AIX平台下空指针问题
[AIX]$cat NullPoint.cpp
#include<stdio.h>
class TIbHubbingDestinationData
{
public:
long long lDestinationId;
char sFmFlag[1+1];
TIbHubbingDestinationData() {}
TIbHubbingDestinationData(const char *sCalledNbr) {}
TIbHubbingDestinationData(const char *sCalledNbr, const char* sFmflag, bool bIsRateIn, long long llServiceId);
virtual int Compare() const;
virtual TIbHubbingDestinationData *Clone() const;
};
int main()
{
TIbHubbingDestinationData *p = NULL;
printf("fmflag:%s\n",p->sFmFlag);
printf("des_id:%lld\n",p->lDestinationId);
return 0;
}
[AIX]$xlC -g -qcheck=all -c NullPoint.cpp
[AIX]$xlC -o NullPoint NullPoint.o
[AIX]$NullPoint
fmflag:
Trace/BPT trap(coredump)
[AIX]$不清楚为什么整型会core,而字符串型可以正常运行 |
|