Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-24 Thread TS
I posted about it on the SWORD api bug tracker. It’s 
http://crosswire.org/tracker/browse/API-190 
. It seems to have been fixed.

-TS___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-17 Thread TS
I see. The code I just uploaded has the brackets, but I’ve made a note to undo 
it I guess and figure out how to get it fixed in the Sword repo. 

Thanks,
TS

> On Oct 13, 2016, at 11:56 AM, Manfred Bergmann  
> wrote:
> 
> Hi.
> 
> 
>> Am 13.10.2016 um 20:28 schrieb TS > >:
>> 
>>  Thank you all for your replies and confirmation. I will use the delete 
>> with the square brackets. 
> 
> I would suggest to stick to the upstream code as much as possible. That 
> means, have someone fix this in the main SWORD repo and pull a copy of it for 
> PS.
> Otherwise it’s hard to reason what exactly is used in PS.
> 
> 
> Manfred
> 
> 
>> 
>>  I also had already looked at the Sword++ code and saw that it had the 
>> brackets which suggested to me that it was correct that something should be 
>> there. 
>>  I had some confusion because in Apple's ObjC framework, they also have 
>> a "new" function and Xcode was directing me to it when I was asking it to 
>> show me where "new" came.(The "new" use to created the variable which needed 
>> delete[]). As a result, I was uncertain as to how Xcode was implementing the 
>> code. I think though that it may be an error for Xcode to be directing me to 
>> the Cocoa definition of "new" since the file has the "cpp" file extension 
>> and so Xcode should know to expect c++ code. Also, "new" isn't being applied 
>> here in the code as a proper objective-c method call (I don't think?), so 
>> I'm thinking that it's being compiled as the "new" from the c++ library.
>> 
>> Thanks again,
>> -TS
>> 
>> On Oct 12, 2016, at 05:16 AM, DM Smith > > wrote:
>> 
>>> 
 On Oct 12, 2016, at 3:22 AM, Jaak Ristioja >>> > wrote:
 On 12.10.2016 10:02, Manfred Bergmann wrote:
> 
>> Am 12.10.2016 um 08:57 schrieb Jaak Ristioja > >:
>> 
>> On 12.10.2016 09:37, Manfred Bergmann wrote:
 On 12.10.2016 01:08, TS wrote:
> Xcode was warning me that in PocketSword's Sword framework, swld.cpp 
> at
> line 111 with
> 
> "delete buf;"
> may be wrong and it should perhaps be
> 
> "delete[] buf;"
> instead. Is this correct? I looked at the code and I think Xcode is
> correct in that the variable is an array and needs the brackets to
> delete properly.
 
 Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
 fixed in Sword++ in March.
>>> 
>>> Despite the warning, would but not be deleted completely?
>> 
>> It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
>> C++ draft at https://github.com/cplusplus/draft 
>>  doesn't have this
>> wording since e51a2152 [1] for some reason.
>> 
> 
> Yeah, don’t get me wrong. It should be corrected.
> But is it indeed a memory leak or does the runtime still collect and 
> destroy all array elements?
> Depends on the runtime probably.
 
 It is undefined behavior (see http://stackoverflow.com/q/2397984/3919155 
 
 ). So as far as the C++ standard is concerned, this might yield
 different behavior depending on the toolchain, the runtime, the
 environment or the phase of the moon... There are also no defined bounds
 to what may happen: it may leak, crash, hang, corrupt memory, whatever...
 
 J
 
>>> 
>>> If I recall delete without the brackets will delete the object. That is the 
>>> array. When called with the brackets will call delete on the elements in 
>>> the array. In some cases the semantic difference does not matter, such as 
>>> an array of char or int. I didn’t look at the code to see if it mattered 
>>> here.
>>> 
>>> DM
>>> ___
>>> sword-devel mailing list: sword-devel@crosswire.org 
>>> 
>>> http://www.crosswire.org/mailman/listinfo/sword-devel 
>>> 
>>> Instructions to unsubscribe/change your settings at above page
>> ___
>> sword-devel mailing list: sword-devel@crosswire.org 
>> 
>> http://www.crosswire.org/mailman/listinfo/sword-devel 
>> 
>> Instructions to unsubscribe/change your settings at above page
> 
> ___
> sword-devel mailing list: sword-devel@crosswire.org 
> 
> http://www.crosswire.org/mailman/listinfo/sword-devel 
> 
> Instructions to unsubscribe/change your settings at above page

___
sword-devel mailing list: sword-devel@crosswire.org
http://w

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-13 Thread Manfred Bergmann
Hi.


> Am 13.10.2016 um 20:28 schrieb TS :
> 
>  Thank you all for your replies and confirmation. I will use the delete 
> with the square brackets.

I would suggest to stick to the upstream code as much as possible. That means, 
have someone fix this in the main SWORD repo and pull a copy of it for PS.
Otherwise it’s hard to reason what exactly is used in PS.


Manfred


> 
>  I also had already looked at the Sword++ code and saw that it had the 
> brackets which suggested to me that it was correct that something should be 
> there.
>  I had some confusion because in Apple's ObjC framework, they also have a 
> "new" function and Xcode was directing me to it when I was asking it to show 
> me where "new" came.(The "new" use to created the variable which needed 
> delete[]). As a result, I was uncertain as to how Xcode was implementing the 
> code. I think though that it may be an error for Xcode to be directing me to 
> the Cocoa definition of "new" since the file has the "cpp" file extension and 
> so Xcode should know to expect c++ code. Also, "new" isn't being applied here 
> in the code as a proper objective-c method call (I don't think?), so I'm 
> thinking that it's being compiled as the "new" from the c++ library.
> 
> Thanks again,
> -TS
> 
> On Oct 12, 2016, at 05:16 AM, DM Smith  wrote:
> 
>> 
>>> On Oct 12, 2016, at 3:22 AM, Jaak Ristioja >> > wrote:
>>> On 12.10.2016 10:02, Manfred Bergmann wrote:
 
> Am 12.10.2016 um 08:57 schrieb Jaak Ristioja  >:
> 
> On 12.10.2016 09:37, Manfred Bergmann wrote:
>>> On 12.10.2016 01:08, TS wrote:
 Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
 line 111 with
 
 "delete buf;"
 may be wrong and it should perhaps be
 
 "delete[] buf;"
 instead. Is this correct? I looked at the code and I think Xcode is
 correct in that the variable is an array and needs the brackets to
 delete properly.
>>> 
>>> Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
>>> fixed in Sword++ in March.
>> 
>> Despite the warning, would but not be deleted completely?
> 
> It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
> C++ draft at https://github.com/cplusplus/draft 
>  doesn't have this
> wording since e51a2152 [1] for some reason.
> 
 
 Yeah, don’t get me wrong. It should be corrected.
 But is it indeed a memory leak or does the runtime still collect and 
 destroy all array elements?
 Depends on the runtime probably.
>>> 
>>> It is undefined behavior (see http://stackoverflow.com/q/2397984/3919155 
>>> 
>>> ). So as far as the C++ standard is concerned, this might yield
>>> different behavior depending on the toolchain, the runtime, the
>>> environment or the phase of the moon... There are also no defined bounds
>>> to what may happen: it may leak, crash, hang, corrupt memory, whatever...
>>> 
>>> J
>>> 
>> 
>> If I recall delete without the brackets will delete the object. That is the 
>> array. When called with the brackets will call delete on the elements in the 
>> array. In some cases the semantic difference does not matter, such as an 
>> array of char or int. I didn’t look at the code to see if it mattered here.
>> 
>> DM
>> ___
>> sword-devel mailing list: sword-devel@crosswire.org 
>> 
>> http://www.crosswire.org/mailman/listinfo/sword-devel 
>> 
>> Instructions to unsubscribe/change your settings at above page
> ___
> sword-devel mailing list: sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-13 Thread TS

     Thank you all for your replies and confirmation. I will use the delete 
with the square brackets.

     I also had already looked at the Sword++ code and saw that it had the 
brackets which suggested to me that it was correct that something should be 
there.
     I had some confusion because in Apple's ObjC framework, they also have a "new" function and Xcode was directing me to it when I was 
asking it to show me where "new" came.(The "new" use to created the variable which needed delete[]). As a result, I was uncertain 
as to how Xcode was implementing the code. I think though that it may be an error for Xcode to be directing me to the Cocoa definition of 
"new" since the file has the "cpp" file extension and so Xcode should know to expect c++ code. Also, "new" isn't being 
applied here in the code as a proper objective-c method call (I don't think?), so I'm thinking that it's being compiled as the "new" from 
the c++ library.

Thanks again,    
-TS

On Oct 12, 2016, at 05:16 AM, DM Smith  wrote:


On Oct 12, 2016, at 3:22 AM, Jaak Ristioja  wrote:
On 12.10.2016 10:02, Manfred Bergmann wrote:

Am 12.10.2016 um 08:57 schrieb Jaak Ristioja :

On 12.10.2016 09:37, Manfred Bergmann wrote:
On 12.10.2016 01:08, TS wrote:
Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
line 111 with

"delete buf;"
may be wrong and it should perhaps be

"delete[] buf;"
instead. Is this correct? I looked at the code and I think Xcode is
correct in that the variable is an array and needs the brackets to
delete properly.

Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
fixed in Sword++ in March.

Despite the warning, would but not be deleted completely?

It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
C++ draft at https://github.com/cplusplus/draft doesn't have this
wording since e51a2152 [1] for some reason.


Yeah, don’t get me wrong. It should be corrected.
But is it indeed a memory leak or does the runtime still collect and destroy 
all array elements?
Depends on the runtime probably.

It is undefined behavior (see http://stackoverflow.com/q/2397984/3919155
). So as far as the C++ standard is concerned, this might yield
different behavior depending on the toolchain, the runtime, the
environment or the phase of the moon... There are also no defined bounds
to what may happen: it may leak, crash, hang, corrupt memory, whatever...

J


If I recall delete without the brackets will delete the object. That is the 
array. When called with the brackets will call delete on the elements in the 
array. In some cases the semantic difference does not matter, such as an array 
of char or int. I didn’t look at the code to see if it mattered here.

DM
___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-12 Thread DM Smith

> On Oct 12, 2016, at 3:22 AM, Jaak Ristioja  wrote:
> 
> On 12.10.2016 10:02, Manfred Bergmann wrote:
>> 
>>> Am 12.10.2016 um 08:57 schrieb Jaak Ristioja :
>>> 
>>> On 12.10.2016 09:37, Manfred Bergmann wrote:
> On 12.10.2016 01:08, TS wrote:
>> Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
>> line 111 with
>> 
>> "delete buf;"
>> may be wrong and it should perhaps be
>> 
>> "delete[] buf;"
>> instead. Is this correct? I looked at the code and I think Xcode is
>> correct in that the variable is an array and needs the brackets to
>> delete properly.
> 
> Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
> fixed in Sword++ in March.
 
 Despite the warning, would but not be deleted completely?
>>> 
>>> It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
>>> C++ draft at https://github.com/cplusplus/draft doesn't have this
>>> wording since e51a2152 [1] for some reason.
>>> 
>> 
>> Yeah, don’t get me wrong. It should be corrected.
>> But is it indeed a memory leak or does the runtime still collect and destroy 
>> all array elements?
>> Depends on the runtime probably.
> 
> It is undefined behavior (see http://stackoverflow.com/q/2397984/3919155 
> 
> ). So as far as the C++ standard is concerned, this might yield
> different behavior depending on the toolchain, the runtime, the
> environment or the phase of the moon... There are also no defined bounds
> to what may happen: it may leak, crash, hang, corrupt memory, whatever...
> 
> J
> 

If I recall delete without the brackets will delete the object. That is the 
array. When called with the brackets will call delete on the elements in the 
array. In some cases the semantic difference does not matter, such as an array 
of char or int. I didn’t look at the code to see if it mattered here.

DM___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-12 Thread Jaak Ristioja
On 12.10.2016 10:02, Manfred Bergmann wrote:
> 
>> Am 12.10.2016 um 08:57 schrieb Jaak Ristioja :
>>
>> On 12.10.2016 09:37, Manfred Bergmann wrote:
 On 12.10.2016 01:08, TS wrote:
> Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
> line 111 with
>
> "delete buf;"
> may be wrong and it should perhaps be
>
> "delete[] buf;"
> instead. Is this correct? I looked at the code and I think Xcode is
> correct in that the variable is an array and needs the brackets to
> delete properly.

 Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
 fixed in Sword++ in March.
>>>
>>> Despite the warning, would but not be deleted completely?
>>
>> It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
>> C++ draft at https://github.com/cplusplus/draft doesn't have this
>> wording since e51a2152 [1] for some reason.
>>
> 
> Yeah, don’t get me wrong. It should be corrected.
> But is it indeed a memory leak or does the runtime still collect and destroy 
> all array elements?
> Depends on the runtime probably.

It is undefined behavior (see http://stackoverflow.com/q/2397984/3919155
). So as far as the C++ standard is concerned, this might yield
different behavior depending on the toolchain, the runtime, the
environment or the phase of the moon... There are also no defined bounds
to what may happen: it may leak, crash, hang, corrupt memory, whatever...

J


___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-12 Thread Manfred Bergmann

> Am 12.10.2016 um 08:57 schrieb Jaak Ristioja :
> 
> On 12.10.2016 09:37, Manfred Bergmann wrote:
>>> On 12.10.2016 01:08, TS wrote:
 Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
 line 111 with
 
 "delete buf;"
 may be wrong and it should perhaps be
 
 "delete[] buf;"
 instead. Is this correct? I looked at the code and I think Xcode is
 correct in that the variable is an array and needs the brackets to
 delete properly.
>>> 
>>> Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
>>> fixed in Sword++ in March.
>> 
>> Despite the warning, would but not be deleted completely?
> 
> It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
> C++ draft at https://github.com/cplusplus/draft doesn't have this
> wording since e51a2152 [1] for some reason.
> 

Yeah, don’t get me wrong. It should be corrected.
But is it indeed a memory leak or does the runtime still collect and destroy 
all array elements?
Depends on the runtime probably.


Manfred
___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-11 Thread Jaak Ristioja
On 12.10.2016 09:37, Manfred Bergmann wrote:
>> On 12.10.2016 01:08, TS wrote:
>>> Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
>>> line 111 with
>>>
>>> "delete buf;"
>>> may be wrong and it should perhaps be
>>>
>>> "delete[] buf;"
>>> instead. Is this correct? I looked at the code and I think Xcode is
>>> correct in that the variable is an array and needs the brackets to
>>> delete properly.
>>
>> Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
>> fixed in Sword++ in March.
> 
> Despite the warning, would but not be deleted completely?

It is undefined behavior, as stated by §3.7.4.2.3 in C++11. However, the
C++ draft at https://github.com/cplusplus/draft doesn't have this
wording since e51a2152 [1] for some reason.

J


[1]:
https://github.com/cplusplus/draft/commit/e51a2152599bce93d72b371590d03960f99f85e3

___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-11 Thread Manfred Bergmann

> Am 12.10.2016 um 01:34 schrieb Jaak Ristioja :
> 
> Hi!
> 
> On 12.10.2016 01:08, TS wrote:
>> Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
>> line 111 with
>> 
>> "delete buf;"
>> may be wrong and it should perhaps be
>> 
>> "delete[] buf;"
>> instead. Is this correct? I looked at the code and I think Xcode is
>> correct in that the variable is an array and needs the brackets to
>> delete properly.
> 
> Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
> fixed in Sword++ in March.

Despite the warning, would but not be deleted completely?


Manfred

___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page


Re: [sword-devel] swld.cpp at line 111 - is this a bug?

2016-10-11 Thread Jaak Ristioja
Hi!

On 12.10.2016 01:08, TS wrote:
> Xcode was warning me that in PocketSword's Sword framework, swld.cpp at
> line 111 with
> 
> "delete buf;"
> may be wrong and it should perhaps be
> 
> "delete[] buf;"
> instead. Is this correct? I looked at the code and I think Xcode is
> correct in that the variable is an array and needs the brackets to
> delete properly.

Yes, Xcode has it correct. It should be `delete[] buf;`. This was also
fixed in Sword++ in March.

Many blessings,
J

___
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page