Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-15 Thread Richard Kimberly Heck
On 2/15/21 5:51 AM, Jean-Marc Lasgouttes wrote:
> Le 15/02/2021 à 01:23, Richard Kimberly Heck a écrit :
>> I'm no expert. I doubt it really matters very much, though maybe we
>> should settle on something, just for consistency. But it looks like
>> "uniform initializaton" is a thing, so maybe we should just get into
>> the habit of using {}. But I'd be happy to say as well: With plain
>> types, we use explicit initialization, e.g., 0 for ints; nullptr, for
>> pointers; etc. But we can use {} for the default with other types.
>
> I prefer this too.

OK, sounds like a consensus. I'll add a note to Development.lyx.

Riki


-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-15 Thread Jean-Marc Lasgouttes

Le 15/02/2021 à 12:32, José Abílio Matos a écrit :

IIRC the first option without the equal sign replaces the notation where 
parenthesis are used:


BufferView const * bv_ {nullptr};
instead of
BufferView const * bv_ (nullptr);

Then it becomes evident that are not using a function call here.


I see. Still, I find it a bit confising.

JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-15 Thread José Abílio Matos
On Sunday, February 14, 2021 6:33:03 PM WET Jean-Marc Lasgouttes wrote:
> Am I right that it
> is the same to write:
> BufferView const * bv_ {};
> BufferView const * bv_ = {};
> BufferView const * bv_ = {nullptr};
> BufferView const * bv_ = nullptr;
> 
> Why do we need to have all these possibilities? In particular the first
> one is weird to me.

IIRC the first option without the equal sign replaces the notation where 
parenthesis are used:

BufferView const * bv_ {nullptr};

instead of

BufferView const * bv_ (nullptr);

Then it becomes evident that are not using a function call here.
-- 
José Abílio-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-15 Thread Jean-Marc Lasgouttes

Le 15/02/2021 à 01:23, Richard Kimberly Heck a écrit :
I'm no expert. I doubt it really matters very much, though maybe we 
should settle on something, just for consistency. But it looks like 
"uniform initializaton" is a thing, so maybe we should just get into the 
habit of using {}. But I'd be happy to say as well: With plain types, we 
use explicit initialization, e.g., 0 for ints; nullptr, for pointers; 
etc. But we can use {} for the default with other types.


I prefer this too.

JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-15 Thread Stephan Witt
Am 15.02.2021 um 01:23 schrieb Richard Kimberly Heck :
> 
> On 2/14/21 3:48 PM, Jean-Marc Lasgouttes wrote:
>> Le 14/02/2021 à 20:40, Richard Kimberly Heck a écrit :
 Yes, it’s a matter of style and I’m ok with this too.
 
 Latest changes made me think it’s more modern to use the {} syntax.
>>> 
>>> The {} notation uses the default initializer, whatever that is. So, yes, 
>>> nullptr would be more explicit but has the same effect.
>>> 
>>> See 
>>> https://arne-mertz.de/2015/07/new-c-features-uniform-initialization-and-initializer_list/
>>>  
>> 
>> 
>> So Riki, what do you prefer in this case?
> 
> I'm no expert. I doubt it really matters very much, though maybe we should 
> settle on something, just for consistency. But it looks like "uniform 
> initializaton" is a thing, so maybe we should just get into the habit of 
> using {}. But I'd be happy to say as well: With plain types, we use explicit 
> initialization, e.g., 0 for ints; nullptr, for pointers; etc. But we can use 
> {} for the default with other types.

I’m not an expert too. But I agree to use nullptr here as it’s the style used 
elsewhere and it’s recommended by Arne Mertz. 

Stephan

> 
> There are some other pretty cool C++11 features in this one
> 
> https://arne-mertz.de/2015/08/new-c-features-inherited-and-delegating-constructors/
> 
> that we might want to use, too.
> 
> Riki
> 
> 

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Richard Kimberly Heck

On 2/14/21 3:48 PM, Jean-Marc Lasgouttes wrote:

Le 14/02/2021 à 20:40, Richard Kimberly Heck a écrit :

Yes, it’s a matter of style and I’m ok with this too.

Latest changes made me think it’s more modern to use the {} syntax.


The {} notation uses the default initializer, whatever that is. So, 
yes, nullptr would be more explicit but has the same effect.


See 
https://arne-mertz.de/2015/07/new-c-features-uniform-initialization-and-initializer_list/ 



So Riki, what do you prefer in this case?


I'm no expert. I doubt it really matters very much, though maybe we 
should settle on something, just for consistency. But it looks like 
"uniform initializaton" is a thing, so maybe we should just get into the 
habit of using {}. But I'd be happy to say as well: With plain types, we 
use explicit initialization, e.g., 0 for ints; nullptr, for pointers; 
etc. But we can use {} for the default with other types.


There are some other pretty cool C++11 features in this one

https://arne-mertz.de/2015/08/new-c-features-inherited-and-delegating-constructors/

that we might want to use, too.

Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Jean-Marc Lasgouttes

Le 14/02/2021 à 20:40, Richard Kimberly Heck a écrit :

Yes, it’s a matter of style and I’m ok with this too.

Latest changes made me think it’s more modern to use the {} syntax.


The {} notation uses the default initializer, whatever that is. So, yes, 
nullptr would be more explicit but has the same effect.


See 
https://arne-mertz.de/2015/07/new-c-features-uniform-initialization-and-initializer_list/ 


So Riki, what do you prefer in this case?

JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Richard Kimberly Heck

On 2/14/21 1:52 PM, Stephan Witt wrote:

Am 14.02.2021 um 19:33 schrieb Jean-Marc Lasgouttes :

Le 14/02/2021 à 18:39, Stephan Witt a écrit :

So the attached patch helps. I’d like to apply it.

-   BufferView const * bv_;
+   BufferView const * bv_ = {};

I am a bit surpisez by these fluctoating notations. Am I right that it is the 
same to write:
BufferView const * bv_ {};
BufferView const * bv_ = {};
BufferView const * bv_ = {nullptr};
BufferView const * bv_ = nullptr;

Why do we need to have all these possibilities? In particular the first one is 
weird to me.

Is there a reason why initializing to {} eems better than initializing to 
nullptr? Isn't the later more explicit?

My first attempt was the 4th variant.

Yes, it’s a matter of style and I’m ok with this too.

Latest changes made me think it’s more modern to use the {} syntax.


The {} notation uses the default initializer, whatever that is. So, yes, 
nullptr would be more explicit but has the same effect.


See 
https://arne-mertz.de/2015/07/new-c-features-uniform-initialization-and-initializer_list/


Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Stephan Witt
Am 14.02.2021 um 19:33 schrieb Jean-Marc Lasgouttes :
> 
> Le 14/02/2021 à 18:39, Stephan Witt a écrit :
>> So the attached patch helps. I’d like to apply it.
> 
> - BufferView const * bv_;
> + BufferView const * bv_ = {};
> 
> I am a bit surpisez by these fluctoating notations. Am I right that it is the 
> same to write:
> BufferView const * bv_ {};
> BufferView const * bv_ = {};
> BufferView const * bv_ = {nullptr};
> BufferView const * bv_ = nullptr;
> 
> Why do we need to have all these possibilities? In particular the first one 
> is weird to me.
> 
> Is there a reason why initializing to {} eems better than initializing to 
> nullptr? Isn't the later more explicit?

My first attempt was the 4th variant.

Yes, it’s a matter of style and I’m ok with this too.

Latest changes made me think it’s more modern to use the {} syntax.

Stephan

> 
> I am asking, because this is probably something that belongs to our code 
> rules.
> 
> JMarc
> -- 
> lyx-devel mailing list
> lyx-devel@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Jean-Marc Lasgouttes

Le 14/02/2021 à 18:39, Stephan Witt a écrit :

So the attached patch helps. I’d like to apply it.


-   BufferView const * bv_;
+   BufferView const * bv_ = {};

I am a bit surpisez by these fluctoating notations. Am I right that it 
is the same to write:

BufferView const * bv_ {};
BufferView const * bv_ = {};
BufferView const * bv_ = {nullptr};
BufferView const * bv_ = nullptr;

Why do we need to have all these possibilities? In particular the first 
one is weird to me.


Is there a reason why initializing to {} eems better than initializing 
to nullptr? Isn't the later more explicit?


I am asking, because this is probably something that belongs to our code 
rules.


JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Jürgen Spitzmüller
Am Sonntag, dem 14.02.2021 um 12:49 -0500 schrieb Richard Kimberly
Heck:
> > > after this change LyX gets a crash on processing Command-F here.
> > The crash is in GuiSearchWidget::findChanged because of bv_ is not
> > initialized and not a nullptr.
> 
> I think you can go ahead.

Yes, thanks.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Richard Kimberly Heck
On 2/14/21 12:45 PM, Stephan Witt wrote:
> Am 14.02.2021 um 18:39 schrieb Stephan Witt :
>> Am 14.02.2021 um 17:15 schrieb Juergen Spitzmueller :
>>> commit 2baa3a46a6ad3576fc94fa0b915adc30ba2bbdff
>>> Author: Juergen Spitzmueller 
>>> Date:   Sun Feb 14 17:18:00 2021 +0100
>>>
>>>   Transform simple search dialog to dock widget (#2625)
>>>
>>>   Also solves #8054
>> Hi Jürgen,
>>
>> after this change LyX gets a crash on processing Command-F here.
> The crash is in GuiSearchWidget::findChanged because of bv_ is not 
> initialized and not a nullptr.

I think you can go ahead.

Riki


-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Stephan Witt
Am 14.02.2021 um 18:39 schrieb Stephan Witt :
> 
> Am 14.02.2021 um 17:15 schrieb Juergen Spitzmueller :
>> 
>> commit 2baa3a46a6ad3576fc94fa0b915adc30ba2bbdff
>> Author: Juergen Spitzmueller 
>> Date:   Sun Feb 14 17:18:00 2021 +0100
>> 
>>   Transform simple search dialog to dock widget (#2625)
>> 
>>   Also solves #8054
> 
> Hi Jürgen,
> 
> after this change LyX gets a crash on processing Command-F here.

The crash is in GuiSearchWidget::findChanged because of bv_ is not initialized 
and not a nullptr.

> I’ve learned the reason here:
> 
> https://arne-mertz.de/2015/08/new-c-features-default-initializers-for-member-variables/
> 
> So the attached patch helps. I’d like to apply it.
> 
> Stephan
> 
> 

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Transform simple search dialog to dock widget (#2625)

2021-02-14 Thread Stephan Witt
Am 14.02.2021 um 17:15 schrieb Juergen Spitzmueller :
> 
> commit 2baa3a46a6ad3576fc94fa0b915adc30ba2bbdff
> Author: Juergen Spitzmueller 
> Date:   Sun Feb 14 17:18:00 2021 +0100
> 
>Transform simple search dialog to dock widget (#2625)
> 
>Also solves #8054

Hi Jürgen,

after this change LyX gets a crash on processing Command-F here.

I’ve learned the reason here:

https://arne-mertz.de/2015/08/new-c-features-default-initializers-for-member-variables/

So the attached patch helps. I’d like to apply it.

Stephan



GuiSearch-member-variable-init.patch
Description: Binary data
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel