Hmm, I haven't gotten my own mail saying I'd review this yet . . .
Lydia
On 07/02/2014 02:58 PM, Brad Chamberlain wrote:
This is another small request for review:
Size of patch: 2/7
Complexity: 1/7
-Brad
-----
Change the return type of is_c_nil from c_int to bool
This commit changes the return type of is_c_nil from c_int to bool. I
reviewed the concept with Michael (who write is_c_nil() originally)
before implementing. I believe that is_c_nil returns a c_int simply
because it was wrapping a C comparison operator that returns an int;
making it a bool seems more natural for Chapel's sake and removes a
case where we rely on C types in something that an end-user or library
writer might want to use.
I implemented this by casting the result to chpl_bool in the C routine
that implements c_is_bool(). To do this, I had to move the definition
of chpl_bool up in the file.
I added a test to lock in this capability.
The reason I ran into this is that I was writing code of the form:
if (!is_c_nil(x))
only to find that it wouldn't work due to our lack of support for ! on
int types, which led me to be surprised that is_c_nil returned an
int. In another patch, I've extended support of ! to include
integers; this commit solves the issue in a different way.
I also simplified existing expressions that use is_c_nil() based on
this change.
Note for discussion: I think I would've called Chapel's notion of
'NULL' 'c_NULL' rather than 'c_nil', much like we call C's 'double'
'c_double' rather than 'c_real'. Put another way, I worry that a C
programmer using Chapel would not find/guess 'c_nil' as quickly as
they would 'c_NULL'. Thoughts?
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers