GraphBLAS / graphblas-api-c

Other
7 stars 3 forks source link

NULL input to GrB_wait as the mode is problematic #44

Closed DrTimothyAldenDavis closed 2 years ago

DrTimothyAldenDavis commented 2 years ago

Providing GrB_NULL as an input option for the mode in GrB_wait (object,mode) is a problem:

mode (IN) Set’s the mode for GrB_wait for whether it is waiting for obj to be in the state of completion or materialization. Acceptable values are GrB_COMPLETE, GrB_MATERIALIZE, or GrB_NULL. Default behavior is to wait for materialization. This occurs for any input value other than GrB_COMPLETE. [Scott: I think we should remove NULL as a valid option.]

The mode is an enum, but GrB_NULL is a pointer. This will cause compilers to complain. I happen to define GrB_NULL as simply NULL, which is zero. GrB_COMPLETE is defined as zero, so I can't tell the difference between it and GrB_NULL. The default is GrB_MATERIALIZE which is 1.

There is no need to state the default for GrB_wait. If you want the default to be GrB_MATERIALIZE then I suggest the enum values: GrB_MATERIALIZE=0 (the default) and GrB_COMPLETE=1 (not the default). A default of zero is simplest.

I don't recommend allowing GrB_NULL as an option for the mode. It adds no utility and terribly complicates my implementation.

mcmillan03 commented 2 years ago

That is two votes for removal (I already have that comment in the spec).

mcmillan03 commented 2 years ago

Tim pushed changes to remove GrB_NULL as an option for mode.