I really like "const" usage, but isn't this too much?

Barry Smith bsmith at mcs.anl.gov
Wed Dec 3 19:43:16 CST 2008


    Sorry, I don't know how to revert something that has been pushed.
Can someone do it who has a brain?

    Barry

On Dec 3, 2008, at 7:41 PM, Lisandro Dalcin wrote:

> Barry, please revert the commit, I'll try to re-review this tomorrow.
> I'm goin to bed.
>
> On Wed, Dec 3, 2008 at 10:40 PM, Lisandro Dalcin <dalcinl at gmail.com>  
> wrote:
>> Barry, are you talking about Vec's of local size zero? Damn me! I
>> completelly forgot this case... But then, will not it be better to
>> check and special case zero local sizes ??
>>
>> On Wed, Dec 3, 2008 at 10:37 PM, Lisandro Dalcin  
>> <dalcinl at gmail.com> wrote:
>>> On Wed, Dec 3, 2008 at 9:17 PM, Barry Smith <bsmith at mcs.anl.gov>  
>>> wrote:
>>>>
>>>>  That is wierd; it seems strange that it would even compile.
>>>
>>> OK, I'll try to review all this tomorrow, there are some other weird
>>> Vec calls with such "const".
>>>
>>>>   BTW: I think your new change
>>>> 7 - v->unplacedarray = v->array; /* save previous array so reset  
>>>> can bring
>>>> it back */ 8
>>>> - v->array = (PetscScalar *)a; 9 +
>>>> if (a) { 10 + v->unplacedarray = v->array; /* save previous array  
>>>> so reset
>>>> can bring it back */ 11
>>>> + v->array = (PetscScalar *)a; 12 + }
>>>> is TOTALLY wrong.
>>>
>>> You see, I should never push before commenting :-(
>>>
>>>> It is perfectly legitimate to place null arrays and one
>>>> wants
>>>> them to behave just like regular place arrays (saving the  
>>>> previous array).
>>>
>>> What's the use case? This is used internally in PETSc? I do not  
>>> remember...
>>>
>>>> Why did you make this change and what was wrong with the way it  
>>>> was?
>>>
>>> Do you mean that it is legitimate taht if a user makes the nasty bug
>>> of calling VecPlaceArray(x,ptr) with ptr being NULL, then next he/ 
>>> she
>>> will get a nasty segfault when calling Vec operations (let say,
>>> VecMax()) ???
>>>
>>> Barry, feel free to revert the changeset. Anyway, please let me know
>>> the rationale for this "feature", I still do not get it...
>>>
>>>
>>>>
>>>> Barry
>>>>
>>>>
>>>> On Dec 3, 2008, at 4:45 PM, Lisandro Dalcin wrote:
>>>>
>>>>> VecPlaceArray(Vec vec,const PetscScalar array[])
>>>>> VecReplaceArray(Vec vec,const PetscScalar array[])
>>>>>
>>>>> --
>>>>> Lisandro Dalcín
>>>>> ---------------
>>>>> Centro Internacional de Métodos Computacionales en Ingeniería  
>>>>> (CIMEC)
>>>>> Instituto de Desarrollo Tecnológico para la Industria Química  
>>>>> (INTEC)
>>>>> Consejo Nacional de Investigaciones Científicas y Técnicas  
>>>>> (CONICET)
>>>>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>>>>> Tel/Fax: +54-(0)342-451.1594
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Lisandro Dalcín
>>> ---------------
>>> Centro Internacional de Métodos Computacionales en Ingeniería  
>>> (CIMEC)
>>> Instituto de Desarrollo Tecnológico para la Industria Química  
>>> (INTEC)
>>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>>> Tel/Fax: +54-(0)342-451.1594
>>>
>>
>>
>>
>> --
>> Lisandro Dalcín
>> ---------------
>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>> Tel/Fax: +54-(0)342-451.1594
>>
>
>
>
> -- 
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>




More information about the petsc-dev mailing list