Microchip
直播中

沈会笛

7年用户 309经验值
私信 关注
[问答]

捕获简单表填充异常

这是函数的一部分。文本是一个指针传递到函数。gfxxxCHAR * GETLIGAGEXETCIN PTR(const gfxxxCHAR *(*text))i,并在这里得到一个例外:如果(文本)!{NULL){返回(GFXXXCHAR *)文本[语言];} {{返回(GFXXXCHAR *)“”;//没有字符串?现在指针明显坏了。但是如何呢?它不是空的。需要一定范围内好吗?编译器有测试功能吗?我宁可排空格,也不例外。

以上来自于百度翻译


      以下为原文

    This is part of a function. text is a pointer passes in to the function.
GFX_XCHAR *getLanguageStringPtr(const GFX_XCHAR *(*text))

I and getting an exception here:

if(text != NULL)
{
    return (GFX_XCHAR *)text[language];
}
else
{
    return (GFX_XCHAR *)""; // No string?
}

Now the pointer is obviously Bad.  But how?  It is Not Null.  does it need to be withing a certain range to be good?
doe the Compiler have a test function?  I would rather have to line blank then an exception.

回帖(11)

吴键洪

2018-11-30 19:41:35
红色应该在那里吗?GFXXXCHAR * GETLIGAGEXETCIN PTR(const gfxxxCHAR *(*text))

以上来自于百度翻译


      以下为原文

    Should the red * be there?
GFX_XCHAR *getLanguageStringPtr(const GFX_XCHAR *(*text))
举报

陈晨

2018-11-30 19:58:19
是的,它是一组指针。代码很好。我只是想弄清楚如何才能不通过一个坏指针。坏指针是我的错误。

以上来自于百度翻译


      以下为原文

    Yes it is an array of pointers.
The code is good. I am just trying to figure out how to figure out how to no pass a bad pointer. The bad pointers are my bugs.
举报

吴键洪

2018-11-30 20:13:11
如果是一个指针表,那么

以上来自于百度翻译


      以下为原文

    If it's a table of pointers, then maybe
if ( (text != NULL) && (*text != NULL) )
 
举报

陈晨

2018-11-30 20:31:17
我会试试看。

以上来自于百度翻译


      以下为原文

    I will try that.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分