Re: XForms: u_?data in object struct - initialized?

Michal Szymanski (msz@bulge.astrouw.edu.pl)
Tue, 17 Mar 1998 10:58:39 +0100 (MET)

# To subscribers of the xforms list from msz@bulge.astrouw.edu.pl (Michal Szymanski) :

>
> # To subscribers of the xforms list from Christopher Sean Hilton <chris@vindaloo.com> :
>
> On Mon, 16 Mar 1998, Steve Lamont wrote:
>
> : # To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
> :
> : > Can one presume that object structure is initialized to zeroes?
> :
> : Yes, the object's data structure is created with a calloc().
> :
> : However, if you're paranoid (always a good practice) you can
> : explicitly set the fields to zero or NULL, as appropriate, after the
> : object is created by your fdesign generated routine or by your own
> : code. The miniscule overhead is probably not worth worrying over.
> :

What do you mean by "fdesign generated routine"? A routine generating
the object or routine initializing it?
BTW, the simplest way I can imagine to do it is something like:

FL_OBJECT *ob;
ob = myform->first;
while ( ob ) {
ob->u_ldata = 0;
ob = ob->next;
}

Is there a better way?

>
> You are kind Steve. I think that it's nothing less than criminal to assume
> the library does anything with the user objects that the user could just
> as easily do for himself with no noticable overhead.
> ...
> By the same token if you want the u_ldata field in the form initialized to
> some value, even if that value is zero, you should initialize it yourself
> when you initialize the rest of the form. It's the =only= way to be sure.
>

Well, I agree that to be 111% sure, one should initialize it himself.
Still, it would be nice if the library would do it for the user
*officially* (i.e. with appropriate statement in the manual). After all,
you do not activate all your form's buttons by hand, do you? You
probably presume that they are active by default.

regards, Michal.

****************************************************************************
Michal Szymanski Internet: msz@sirius.astrouw.edu.pl
Warsaw University Observatory Bitnet: msz@plwauw61.bitnet
Al. Ujazdowskie 4 Voice: 48-22-6294011 ext 23
00-478 Warszawa, POLAND FAX: 48-22-6294967
****************************************************************************
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/