Ticket #67 (new enhancement)

Opened 3 years ago

Last modified 1 year ago

Change method return values from int to bool if they return SUCCESS or FAILURE

Reported by: samm Assigned to: everybody
Priority: minor Milestone:
Component: BambooLib Version:
Keywords: SUCCESS FAILURE anonymous enum Cc:
Blocking:

Description

When compiling SSSCommander Michael and I noticed a strange error on my G5 (10.3.9 w/ gcc 4.0)

Cluster.cpp: In member function 'BambooLib::ParseMsg* SSSObjects::Cluster::send_query(BambooLib::BuildMsg&, SSSObjects::Cluster::address)':
Cluster.cpp:190: error: '<anonymous enum>' is/uses anonymous type
Cluster.cpp:190: error:   trying to instantiate 'template<class T> template<class To> bool SSSObjects::operator==(SSSObjects::value&, To&)'

We fixed this by changing the SUCCESS and FAILURE anonymous enums to a preprocessor macro that expands to true or false. While any method that used the old anonymous enums as return values will still compile without errors, the return value should be changed to a bool for completeness purposes.

Here's the old source file with the anonymous enum definitions source:libbamboo/trunk/source/libbamboo/define.h@88

And here's the new one with the preprocessor macros source:libbamboo/trunk/source/libbamboo/define.h@255

Change History

04/13/06 19:59:35 changed by samm

Should we change these macros to be a const bool? ex:

const bool SUCCESS = true;
const bool FAILURE = false;

I prefer to avoid macros unless they are required.

04/13/06 20:20:26 changed by samm

(In [256]) References #67. Removed some old junk from define.h and changed the return values of all the methods using SUCCESS and FAILURE in the various wire protocol classes.

04/14/06 18:43:27 changed by mekstran

const bool is fine with me; I'd agree that macros are largely icky (runs to hide sssapp/log.h).

04/17/06 05:29:05 changed by samm

(In [274]) References #67, removed the ErrorPredicate? class from Enforce.h since it's no longer needed now that SUCCESS is defined as true.

04/17/06 05:57:14 changed by samm

(In [275]) References #67, changed the return values of some methods to bool instead of int