Search found 2531 matches

by Tourist Trap
Jan 20, 2019 11:17
Forum: General
Topic: Redim NEW constructed pointers calls the DELETE?
Replies: 9
Views: 131

Re: Redim NEW constructed pointers calls the DELETE?

This kind of code always gets longer then planned. Thanks, that's indeed very longer than expected. You used NEW however. So maybe here: sub array_udt.eraseAndDelete() for i as integer = 0 to ubound(pArray) pArray(i)->destructor pArray(i) = 0 next erase pArray end sub Pointer = 0, should be if we f...
by Tourist Trap
Jan 20, 2019 10:38
Forum: General
Topic: Redim NEW constructed pointers calls the DELETE?
Replies: 9
Views: 131

Re: Redim NEW constructed pointers calls the DELETE?

I think that both are not good: Yes, both are bad. Yes? So you would construct the objects by value outside the array and then add their address to the array? dim as UDT u1 array(1) = @ u1 erase array '.. u1 is still leaving its life This is a little like using New without memory leaks due to the f...
by Tourist Trap
Jan 20, 2019 10:09
Forum: General
Topic: Redim NEW constructed pointers calls the DELETE?
Replies: 9
Views: 131

Re: Redim NEW constructed pointers calls the DELETE?

No The general rule is: If you call New, you must call Delete as many times. Ok. So I should rather use this: redim as udt ptr array(1) array(1) =@(udt()) erase array  ' content deleted or memory leak? Unless NEW leads to something faster for an reason I ignore? Maybe NEW doesn't require an explici...
by Tourist Trap
Jan 20, 2019 9:43
Forum: General
Topic: Redim NEW constructed pointers calls the DELETE?
Replies: 9
Views: 131

Redim NEW constructed pointers calls the DELETE?

Hello,

if I have an array of udt ptr constructed with NEW. Will the ERASE or REDIM call the DELETE for us?

Code: Select all

redim as udt ptr array(1)
array(1) = new udt
erase array  ' content deleted or memory leak? -> leak confirmed



Thanks
by Tourist Trap
Jan 20, 2019 9:01
Forum: Tips and Tricks
Topic: [S]imple [N]etwork [C]onnection win and lin 32/64-bit.
Replies: 69
Views: 10624

Re: [S]imple [N]etwork [C]onnection win and lin 32/64-bit.

@leopardpm I can't send you an working example since Monday I'm in hospital I use only the first post as reference to show you pseudo code for a "simple" chat server. Hi D.J.Peters, if the nurse sees you coding even pseudo-coding and compiling, she will not be happy. You have to run this ...
by Tourist Trap
Jan 20, 2019 8:53
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

Could a byref function be more versatile than property? You can have many parameters, get and set, and the code is more readable and shorter. #include "crt.bi" type UDT extends OBJECT declare function Prop() byref as integer private: as integer ref=1 end type function UDT.Prop() byref as ...
by Tourist Trap
Jan 20, 2019 8:24
Forum: Community Discussion
Topic: Moderator's Environment and Tools.
Replies: 4
Views: 219

Re: Moderator's Environment and Tools.

Hi Richard, hi all, Yes it's quite right that there is no way to always have all the data of context in order for anyone, including a moderator, to make/take the right opinion/decision at anytime. To deliver those data of context, or to leave anyone the opportunity to deliver them if any, it's neces...
by Tourist Trap
Jan 19, 2019 20:33
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

fxm wrote:Only one indexing parameter is allowed for a get/set-Property.

For a setter, 2 slots are allowed. Ok I never paid attention to this :)
Does this mean that the getter index is an integer only?
by Tourist Trap
Jan 19, 2019 20:22
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

Note: When a get-Property is defined with one 'index' parameter, the 'fieldname=' syntax can not be used to return a value. For such a get-Property, the 'property=' syntax (in addition to the 'return' syntax) is only the one allowed. Fine, but then arises a question....
by Tourist Trap
Jan 19, 2019 20:04
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

Note: An indexed get-Property can not use the 'fieldname=' syntax to return a value. For such an indexed get-Property , the 'property=' syntax (in addition to the 'return' syntax) is only the one allowed. I would rather say "a get-Property with parameters passed". ...
by Tourist Trap
Jan 19, 2019 16:11
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

Yes (even if there is no setter defined). You know fxm, that's why, in general I always name the setter parameter "Setvalue". For example: type UDT2 extends OBJECT declare property Prop2(byval as integer) as integer end type property UDT2.Prop2(byval Setvalue as integer) as integer prop2 ...
by Tourist Trap
Jan 19, 2019 15:58
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

Am I already asleep? You defined a setter without index and a getter with index. Ahah that's the problem with real life code examples. In my project it's even worst, my property has also the same name as the type returned. I have namespaces so it's ok. In any case I'm simplifying in this project wh...
by Tourist Trap
Jan 19, 2019 15:42
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value (solved)

@admin: More generally the syntax 'vvv.Prop2 = x' does not trig error! (calling to the property-setter without specifying an index value) This case maybe can be confusing: dim shared prop2 as integer type UDT2 extends OBJECT declare property Prop2(byval as integer) declare property Prop2(byval as i...
by Tourist Trap
Jan 19, 2019 15:35
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value or related

Use 'Property = x' . (it is similar to 'Function = x' ) Ahhh :) Thanks I totally forgot this variation. So we have: propname = returnvalue property = returnvalue or if no more code left after the return: return returnvalue. It will do the job then, even if I made some other adhoc ch...
by Tourist Trap
Jan 19, 2019 15:25
Forum: General
Topic: Trouble with Property returning by propName = value (solved)
Replies: 20
Views: 221

Re: Trouble with Property returning by propName = value or related

For a property-GETTER, use 'Property = x' or 'Return x' syntax. Hello fxm, Sure I would use RETURN, but in the true project, I have to clean-up a POINTER constructed with NEW just after I returned it: property X dim tri as TRIANGLE => new TRIANGE '...do stuff X = tri delete tri end ...

Go to advanced search