Subject | Re: By Description (was: Re: [ib-support] Unverified Firebird 1 Beta2 Release notes) |
---|---|
Author | Doug Chamberlin |
Post date | 2001-09-04T22:01:11Z |
At 9/4/2001 04:25 PM (Tuesday), Martijn Tonies wrote:
function. Where "by reference" passes a pointer to the argument and "by
value" passes the argument value itself (usually on the stack or in a
register) "by descriptor" passes a pointer to a descriptor block in memory.
The descriptor block usually contains a type identifier, a value or pointer
to a value, and any other useful info. In this case the "other useful info"
would be a NULL flag.
I first encountered descriptors in VMS where, IIRC, they were often used
for passing strings. The descriptor held the buffer size of a string buffer
as well as the "used size". This was often more useful than passing a
pointer to a char array (a la C) since the called function could safely
utilize the string buffer as it needed without having to treat the incoming
string as readonly.
If we had a standard descriptor definition and FB could be told to pass
arguments to UDFs using it then the UDFs could detect NULLs being passed.
This would be a big improvement! If UDFs could also return values via
descriptors they could return NULL states as well.
> > > where can I find information about UDFs arguments 'by descriptor'?"By Descriptor" is an alternative method of passing an argument to a
function. Where "by reference" passes a pointer to the argument and "by
value" passes the argument value itself (usually on the stack or in a
register) "by descriptor" passes a pointer to a descriptor block in memory.
The descriptor block usually contains a type identifier, a value or pointer
to a value, and any other useful info. In this case the "other useful info"
would be a NULL flag.
I first encountered descriptors in VMS where, IIRC, they were often used
for passing strings. The descriptor held the buffer size of a string buffer
as well as the "used size". This was often more useful than passing a
pointer to a char array (a la C) since the called function could safely
utilize the string buffer as it needed without having to treat the incoming
string as readonly.
If we had a standard descriptor definition and FB could be told to pass
arguments to UDFs using it then the UDFs could detect NULLs being passed.
This would be a big improvement! If UDFs could also return values via
descriptors they could return NULL states as well.