Re: [xml] what should to be 'const'?



On Tue, May 22, 2007 at 10:47:09AM +0200, Andreas Stricker wrote:
massimo morara wrote:
 >    In the function xmlCopyNode(const xmlNodePtr node, int
 > extended) [tree.c], what is supposed be 'const'?

The "node" argument to xmlCopyNode function is guaranteed not not
to be modified by this function (no side effects).

        'xmlNodePtr' is a typedef, so the prototype now say "the pointer 
'node' is non modifiable; the data pointed by 'node' are modifiable".
        If i'm not wrong, obviously.
        If 'xmlNodePtr' were a macro (thanks Rush), the things would be 
different.
        I don't speek a good english, so it is very difficult
for me to express what i mean. Sorry for this.
        My doubt is: what is the intent? What should be costant?
        The pointer 'node'?
        The data pointed by 'node'?
        Both?
        I suppose the data pointed by 'node' or both, non only the 
pointer.

                massimo morara

-- 

"Everything will work just as you expect it to, unless your expectations
 are incorrect"
-- Hyman Rosen 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]