[drmaa-wg] buffer length/size
Piotr Domagalski
szalik at szalik.net
Sat Jun 17 05:48:02 CDT 2006
On Fri, Jun 16, 2006 at 05:17:37PM +0200, Piotr Domagalski wrote:
> a wrong argument in function calls could lead to a crash. From C-binding
> document:
>
> job_id_len - The size in characters of the job identifier buffer.
>
> This would clearly mean sizeof(buf), but the "characters" makes me think
> it could be the maximum number of printable characters that will be put
> into the buffer. In my opionion this word is not needed here, it should
> only say "the size of the job identifier buffer".
... and as I see in SGE's DRMAA implementation[1], all the _len
arguments are treated as maximum string lengths, thus the input buffer
is always considered to have size of (job_id_len + 1).
So, to sum up, should implementations treat these arguments as size of
the buffer or the maximum string length that would be put into the
buffer?
---------------------
[1] By the way: some comments in the code are a bit misleading:
OUTPUTS
char *job_id - buffer for resulting jobid
size_t job_id_len - size of job_id buffer
char *error_diagnosis - diagnosis buffer
size_t error_diag_len - diagnosis buffer length
The "size of job_id buffer" seems completly wrong, whereas "buffer
length" is not a clear wording from the C language perspective.
--
Piotr Domagalski
More information about the drmaa-wg
mailing list