c里关于char指针的问题求解答

求解答下面c代码片段中为什么语句: if(non_alphanum(*(++ch)))
中使用*(++ch)不行,必须使用*(ch+1)?
补充环境信息:Linux 4.4.0-64-generic #85-Ubuntu

 #define is_alphanum(c) (((c)>='A' && (c) <= 'Z') || ((c) >= 'a' && \
        (c) <= 'z') || ((c) >= '0' && (c) <= '9'))
#define non_alphanum(c) !is_alphanum((c))

int is_word_delimiter(char * ch)
{
    /*
     * Use a static variable to remember whether previous 
     * character is a delimiter, if true, then the 
     * following '\'' is also a delimiter
     * e.g. "hello 'world'":both '\'' is delimiter
     *  "don't": '\'' is not a delimiter
     *
     *  Initialize the variable to 1 to indicate "'hello'" cases
     */
    static int pre_char_is_delimiter = 1;
    if(*ch == '\''){
        /*
         * NOTE: can't use *(++ch), dont know why 
         * but is truely has the side effect of 
         * changing the ch pointer itself.
         * Gdb shows that ++ch cause ch pointer to 
         * shift 3 characters, WTK.
         */
        if(non_alphanum(*(++ch))){
            pre_char_is_delimiter = 1;
            return 1;
        }else if(pre_char_is_delimiter){
            pre_char_is_delimiter = 1;
            return 1;
        }else{
            pre_char_is_delimiter = 0;
            return 0;
        }
    }   
    if(is_alphanum(*ch)){
        pre_char_is_delimiter = 0;
        return 0;
    } else{
        pre_char_is_delimiter = 1;
        return 1;
    }
}

#define non_alphanum(c) !is_alphanum((c))

定义了宏non_alphanum,
这样

 if(non_alphanum(*(++ch)))

相当于

 if(!is_alphanum((*(++ch))))

而is_alphanum又是一个宏, 具体你可以看下代码头部

这样在is_alphanum宏展开后,ch自增了不止一次,从而出现了题目中的现象。

++ch会改变ch本身,下次调用ch的时候,就相当于ch+1
而ch+1,则不会改变ch,下次调用,还是ch