This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: JvSynchronize nitpick


How about:

class JvSynchronizeHelper
{
  JvSynchronize sync;
public:
  JvSynchronizeHelper (const jobject &obj) : sync (obj) {}
  operator bool () const { return false; }
};

#define synchronized(OBJECT) \
  if (const JvSynchronizeHelper& __JvX = JvSynchronizeHelper((OBJECT))) \
    ; \
  else

Or, even better: can't JvSynchronize have an implicit converter to
bool false?

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]