Jorgen Loland a écrit, Le 26.08.2010 13:19:
>
> On 08/25/2010 11:45 AM, Guilhem Bichot wrote:
>> Hello,
>>
>> Jorgen Loland a écrit, Le 18.08.2010 11:01:
>>> #At file:///export/home/jl208045/mysql/mysql-next-mr-bugfixing-30597/
>>> based on revid:joerg@stripped
>>>
>>> 3220 Jorgen Loland 2010-08-18
>>> Bug#30597: Change EXPLAIN output to include extrema of UNION components
>>
>>> === modified file 'sql/sql_lex.h'
>>> --- a/sql/sql_lex.h 2010-08-16 18:21:24 +0000
>>> +++ b/sql/sql_lex.h 2010-08-18 09:01:38 +0000
>>> @@ -712,6 +712,13 @@ public:
>>> }
>>> st_select_lex* outer_select();
>>> st_select_lex* next_select() { return (st_select_lex*) next; }
>>> +
>>> + inline st_select_lex* last_select() {
>>
>> you can declare this function "const", it doesn't change data.
>
> If this object does not have a next, we effectively return 'this', which
> is const inside a const function. But we don't want the return pointer
> to be const, so I don't think that it makes sense to do this.
>
> Simply changing to "inline st_select_lex* last_select() const {...}"
> gives compiler warning:
>
> sql/sql_lex.h:765: error: invalid conversion from ‘const st_select_lex*
> const’ to ‘st_select_lex*’
>
> Ok to push without const, or do you have another idea?
Ok, I understand now... adding const to the function makes it be passed
"this" as a "const select_lex*", so the return type of the function has
to be this type too, and then users of this function cannot freely use
the return value :-(
Ok to push without const.