compilation error

Ron Alexander rcalex at
Tue Oct 10 20:28:40 GMT 2000

Everything compiles now, but I get

[2000/10/10 16:17:40, 0] util.c:(2381)
  PANIC: assert failed

Since I am leaving for a conference Fri. morning and I have some other
serious problems to address, I am going to return my smb.h to the state it
was before.

I still think that either SMB_ASSERT or DEBUG has a problem.

I will resume testing when I return.


-----Original Message-----
From: Ron Alexander [mailto:rcalex at]
Sent: October 10, 2000 3:41 PM
To: herb at
Cc: Gerald Carter; David Collier-Brown; samba-technical at
Subject: RE: compilation error


I changed the SMB_ASSERT back to the original and re-compiled. The errors I
get are like the following:


Source code
973 SMB_ASSERT(len < 80);

Generated code
 ((len < 80)?(void)0: ((void)( (DEBUGLEVEL >= (0)) && (dbghdr( 0,
("util.c"), (""), (973) ))
   && (dbgtext ("PANIC: assert failed at %s(%d)\n", "util.c", 973)) ),
smb_panic("assert failed")));

If instead of ((void)( (DEBUGLEVEL >= (0)) we had
               (void)( (DEBUGLEVEL >= (0)) then my error goes away.

This means that it should be:
#define SMB_ASSERT(b) ((b)?(void)0: \
        DEBUG(0,("PANIC: assert failed at %s(%d)\n", \
     __FILE__, __LINE__)), smb_panic("assert failed"))

instead of
#define SMB_ASSERT(b) ((b)?(void)0: \
        (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \
     __FILE__, __LINE__)), smb_panic("assert failed")))

I am going to make that change and re-compile everything to see if anything
else breaks.


-----Original Message-----
From: herb at [mailto:herb at]
Sent: October 10, 2000 12:50 PM
To: Ron Alexander
Cc: Gerald Carter; David Collier-Brown; samba-technical at
Subject: Re: compilation error

Ron Alexander wrote:
> Actually I started this, and DCB tested it on one of his SUN boxes. We
> got severe compile errors.
> I am not a language lawyer, but everyone I have shown this to says the
> thing, "it's invalid C syntax".

I disagree. If you look at what actually gets generated, you are mixing
two different types as the results of the conditional operator.

The 0 by default is type int. The DEBUG macro is defined as type (void).
So you say if x is true make the expression an int but if x is false
the expression a void. The IRIX compiler forces you to declare both
operands as the same type. Maybe you could argue that this is too
restrictive but I wouldn't call it a bug.

Either of the following would be correct (I simplified the macro to
make it easier to see what is happening printf is decalred an int)

#define SMB_ASSERT(b) ((b)?(void)0: (void)printf(""))
#define SMB_ASSERT_OK(b) ((b)?0: printf(""))

> I respectfully submit that the IRIX C compiler has a bug if it requires
> syntax. If that is the case, then the code should be changed to ifdef the
> IRIX case since it is the one that is unique.
> I can find and forward original e-mail between me and DCB and
> samba-technical if needed.
> Ron Alexander

Herb Lewis                               Silicon Graphics
Networking Engineer                      1600 Amphitheatre Pkwy MS-510
Strategic Software Organization          Mountain View, CA  94043-1351
herb at                             Tel: 650-933-2177                       Fax: 650-932-2177

More information about the samba-technical mailing list