allowing Structures to be allowed in procedures returns...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

allowing Structures to be allowed in procedures returns...

Post by Dreglor »

I would like to see Structures to be allowed in procedure returns and arguments, and also allow structures to assined like normal varablies like Me.person=You.Person

that would help me alot in my projects as i always use structures i hate it when i want to return a structure and i have to return a pointer and have the code go to other procedures (or have the normal code) have it rip apart the structure thru pokes to get the data
~Dreglor
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

can be done already;

Code: Select all

Structure FOO
   parm1.l
EndStructure
structmyfoo.FOO

Procedure.l FillFoo(structmyfoo.l)
  *myfoo.FOO=structmyfoo
    myfoo\parm1=1
    ProcedureReturn *myfoo
EndProcedure

structmyfoo.FOO=FillFoo(structmyfoo)
at least I think that is the way it works.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Yea you must use a pointer to return
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Inner, that's not well done.

Dreglor, i've requested it: viewtopic.php?t=13416
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Yes it would be a nice feature
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

It would be very useful.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply