This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g_assertions


Here's a simple example that fails to compile:-

#include <glib.h>

void my_func ()
{
int x = 3;

   g_assert (x);
}


Can anyone reproduce this problem? Or am I missing something obvious?


Thanks,

John





----- Original Message ----- From: "John Emmas"
Sent: 22 September 2008 10:08
Subject: g_assertions



Hi - I hope this is an appropriate place to ask this question.  I'm just
starting to use Cygwin.  Firstly, the Cygwin web site says that the
current
version is 1.5.25-15 but my install log says that it installed 2.573.2.3
so
I'm a bit confused about that.  Anyway, apart from that, the installation
seemed to succeed and I've been using Cygwin, off & on, for a few weeks.

I'm now starting to compile a project using glibmm.  Inside glib.h there
are
some assertions, defined something like this:-

#define g_assert(expr)   G_STMT_START{  \
    if (!(expr))      \
      g_log (G_LOG_DOMAIN,     \
      G_LOG_LEVEL_ERROR,    \
      "file %s: line %d: assertion failed: (%s)", \
      __FILE__,      \
      __LINE__,      \
      #expr);   }G_STMT_END

These compile perfectly with my gcc compiler but when I try to use them
with
Cygwin I get this error:-

error: stray '\' in program

It's pretty obvious why this is happening - but terminating a line with
'\'
is valid code.  Has anyone else experienced this problem?  I can eliminate
it by #defining G_DISABLE_ASSERT - but then I'll lose the assertion
checks, which I'd really like to keep.  Is there something else I could do
to prevent this error?

Thanks,

John



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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