View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006475 | GNUnet | util library | public | 2020-08-11 17:36 | 2020-08-15 05:12 |
Reporter | Florian Dold | Assigned To | schanzen | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Target Version | 0.13.2 | Fixed in Version | 0.13.2 | ||
Summary | 0006475: GNUNET_is_zero is a dangerously bad name | ||||
Description | A function that has "is" in the name would usually be expected to return a boolean. However, struct GNUNET_HashCode hc = {0}; if (GNUNET_is_zero (&hc)) printf("good"); else printf("gotcha!"); actually prints "gotacha!". I get where this is coming from (0 == memcmp (...)), but it's still bad. Can we at least rename it to GNUNET_cmp_zero? This has bitten me twice in unrelated places now. | ||||
Tags | No tags attached. | ||||
|
IMO it should return "enum GNUNET_GenericReturnValue" and not int. I also would have assumed that it would return != 0 on success. But it does not. To me, either swapping the return values or using the enum is a viable solution. |
|
I changed the API in be3bbfb47..99f820453 |
|
Closing as resolved since at least 0.13.2 |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-08-11 17:36 | Florian Dold | New Issue | |
2020-08-11 20:53 | schanzen | Note Added: 0016588 | |
2020-08-11 20:54 | schanzen | Assigned To | => schanzen |
2020-08-11 20:54 | schanzen | Status | new => acknowledged |
2020-08-12 09:43 | schanzen | Status | acknowledged => resolved |
2020-08-12 09:43 | schanzen | Resolution | open => fixed |
2020-08-12 09:43 | schanzen | Fixed in Version | => 0.13.2 |
2020-08-12 09:43 | schanzen | Note Added: 0016590 | |
2020-08-12 09:43 | schanzen | Target Version | => 0.13.2 |
2020-08-14 12:04 | schanzen | Note Added: 0016605 | |
2020-08-14 12:04 | schanzen | Status | resolved => closed |